Chapter 6 Section 6.2
Using VSAM Operations VSAM eWay Database Operations (JCD)
VSAM eWay Adapter User’s Guide 57 Sun Microsytems, Inc.
}
}
The Insert Operation

To perform an insert operation on a table:

1Execute the insert() method. Assign a field.

2Insert the row by calling insertRow()

This example inserts an employee record:

package prjVSAM_JCDjcdALL;
public class jcdInsert
{
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,
dtd.otdInputDTD_622919076.Emp otdInputDTD_Emp_1, otdVSAM.OtdVSAMOTD
otdVSAM_1, com.stc.connector.appconn.file.FileApplication
FileClient_1 )
throws Throwable
{
FileClient_1.setText( "Inserting records into CICSEMP table
.." );
FileClient_1.write();
otdInputDTD_Emp_1.unmarshalFromString( input.getText() );
otdVSAM_1.getCICSEMP().insert();
for (int i1 = 0; i1 < otdInputDTD_Emp_1.countX_sequence_A();
i1 += 1) {
otdVSAM_1.getCICSEMP().setENAME(
otdInputDTD_Emp_1.getX_sequence_A( i1 ).getENAME() );
otdVSAM_1.getCICSEMP().setPHONE(
typeConverter.stringToInt( otdInputDTD_Emp_1.getX_sequence_A( i1
).getPHONE(), "#", false, 0 ) );
otdVSAM_1.getCICSEMP().setMAILID(
otdInputDTD_Emp_1.getX_sequence_A( i1 ).getMAILID() );
otdVSAM_1.getCICSEMP().setSALARY( new
java.math.BigDecimal( otdInputDTD_Emp_1.getX_sequence_A( i1
).getSALARY() ) );
otdVSAM_1.getCICSEMP().setJOBID(
typeConverter.stringToDouble( otdInputDTD_Emp_1.getX_sequence_A( i1
).getJOBID(), "#.000000;-#.000000", false, 0 ) );
otdVSAM_1.getCICSEMP().setEMPID(
typeConverter.stringToInt( otdInputDTD_Emp_1.getX_sequence_A( i1
).getEMPID(), "#", false, 0 ) );
otdVSAM_1.getCICSEMP().setDEPTID(
typeConverter.stringToShort( otdInputDTD_Emp_1.getX_sequence_A( i1
).getDEPTID(), "#", false, 0 ) );
otdVSAM_1.getCICSEMP().setDEPARTMENT(
otdInputDTD_Emp_1.getX_sequence_A( i1 ).getDEPARTMENT() );
otdVSAM_1.getCICSEMP().insertRow();
}