Using Database Operations

The Query (Select) Operation

ProcedureTo perform a query operation on a table:

  1. Execute the select() method with the “where” clause specified if necessary.

  2. Loop through the ResultSet using the next() method.

  3. Process the return record within a while() loop.

    For example:


    package prjVSAM_JCDjcdALL;
    
    public class jcdTableSelect
    {
    
        public com.stc.codegen.logger.Logger logger;
    
        public com.stc.codegen.alerter.Alerter alerter;
    
        public com.stc.codegen.util.CollaborationContext collabContext;
    
        public com.stc.codegen.util.TypeConverter typeConverter;
    
        public void receive( com.stc.connector.appconn.file.
    FileTextMessage input, otdVSAM.OtdVSAMOTD otdVSAM_1, dtd.
    otdOutputDTD_1935483687.Emp otdOutputDTD_Emp_1, com.stc.connector.
    appconn.file.FileApplication FileClient_1 )
            throws Throwable
        {
            FileClient_1.setText( "Selecting record(s) from CICSEMP
    table via table select .." );
            FileClient_1.write();
            otdVSAM_1.getCICSEMP().select( input.getText() );
            while (otdVSAM_1.getCICSEMP().next()) {
                otdOutputDTD_Emp_1.setENAME( otdVSAM_1.getCICSEMP().getENAME() );
                otdOutputDTD_Emp_1.setPHONE( typeConverter.intToString( otdVSAM_1.
    getCICSEMP().getPHONE(), "#", false, "" ) );
                otdOutputDTD_Emp_1.setMAILID( otdVSAM_1.getCICSEMP().getMAILID() );
                otdOutputDTD_Emp_1.setSALARY( otdVSAM_1.getCICSEMP().getSALARY().
    toString() );
                otdOutputDTD_Emp_1.setJOBID( typeConverter.doubleToString(
     otdVSAM_1.getCICSEMP().getJOBID(), "#.000000;-#.000000", false, "" ) );
                otdOutputDTD_Emp_1.setEMPID( typeConverter.intToString(
     otdVSAM_1.getCICSEMP().getEMPID(), "#", false, "" ) );
                otdOutputDTD_Emp_1.setDEPTID( typeConverter.shortToString(
     otdVSAM_1.getCICSEMP().getDEPTID(), "#", false, "" ) );
                otdOutputDTD_Emp_1.setDEPARTMENT( otdVSAM_1.getCICSEMP().getDEPARTMENT() );
                FileClient_1.setText( otdOutputDTD_Emp_1.marshalToString() );
                FileClient_1.write();
            }
            FileClient_1.setText( "Done table select." );
            FileClient_1.write();
        }
    
    }