I’m writing a job that will transfer property from one agency to another. It does the following:
- Step 1 uses ICETOOL to check for possible duplicate fields in an input dataset supplied by a state agency. (It looks at two fields: SENDING PROPERTY ITEM NUMBER and RECEIVING PROPERTY ITEM NUMBER). It it finds any duplicates, they’re written to an error file and processing terminates. If it doesn’t find any, the report will have a record count of 0 and processing continues.
Step 2 combines the two error files into one error file.
Step 3 executes a Natural program to run the input file against production data to ensure that no duplicate records will be created for the receiving agency in the property transfer. If there are possible duplicates, they’re written to the same error file as above, and processing terminates.
If either step has an abnormal termination, another job is triggered that will notify selected individuals of the errors via e-mail, using the error file as the e-mail attachment.
My problem is that the error file in steps 1 & 2 has a record length of 133. But when I add the third step, the length of the error dataset changes to 252 and I get a “severe error” message when I try to look at the dataset.
Here’s my JCL:
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=A
//DFSMSG DD SYSOUT=A
//IN1 DD DSN=PROPERTY.INPUT,DISP=SHR
//SENDITEM DD DSN=DUP.ITEMS.SEND.RPT,DISP=(NEW,CATLG),
// DCB=(RECFM=FBA,LRECL=133)
//RECVITEM DD DSN=DUP.ITEMS.RECV.RPT,DISP=(NEW,CATLG),
// DCB=(RECFM=FBA,LRECL=133)
//DUPS DD DSN=DUP.ITEMS,DISP=(NEW,CATLG),
// DCB=(RECFM=FB,LRECL=177)
//TOOLIN DD *
* OUTPUT REPORT SHOWING ANY RECORDS WITH DUPLICATE ITEM NUMBERS
SELECT FROM(IN1) TO(DUPS) ON(1,14,CH) ALLDUPS
DISPLAY FROM(DUPS) LIST(SENDITEM) WIDTH(133) -
TITLE('DUPLICATE SENDING ITEMS') -
NOHEADER -
ON(1,6,CH,L'AGCY ') -
ON(7,8,CH,L'ITEM # ') -
COUNT('TOTAL DUPLICATE SENDING ITEMS:') EDCOUNT(U05)
SELECT FROM(IN1) TO(DUPS) ON(30,8,CH) ALLDUPS
DISPLAY FROM(DUPS) LIST(RECVITEM) WIDTH(133) -
TITLE(' ') -
TITLE('DUPLICATE RECEIVING ITEMS') -
NOHEADER -
ON(15,6,CH,L'AGCY ') -
ON(30,8,CH,L'ITEM # ') -
COUNT('TOTAL DUPLICATE RECEIVING ITEMS:') EDCOUNT(U05)
COUNT FROM(DUPS) HIGHER(0) RC4
/*
//*
//STEP02 EXEC PGM=SYNCSORT
//SYSOUT DD SYSOUT=A
//SORTIN DD DSN=DUP.ITEMS.SEND.RPT,DISP=SHR
// DD DSN=DUP.ITEMS.RECV.RPT,DISP=SHR
//SORTOUT DD DSN=PROPERTY.XFER.ERRORS,DISP=(NEW,CATLG),
// DCB=(RECFM=FBA,LRECL=133)
//SYSIN DD *
SORT FIELDS=COPY
END
/*
//*
//STEP03 EXEC NATTPROC,NATPGM=XXXXX,CNTL=XXXXX,COND=(0,NE),
// PRTOUT=A,SYSOUT=A,JCLOUT=D
//CMWKF01 DD DSN=PROPERTY.INPUT,DISP=SHR
//CMPRT01 DD DSN=PROPERTY.XFER.ERRORS,DISP=MOD
//SYSIN DD *
LOGON XXXXXXXX
EX PROPXFER
//
Here are the WRITE(1) statements within the PROPXFER program:
READ WORK FILE 1 #WKF01
ADD 1 TO #WF1-READ
MOVE #TO-AGCY TO #PROPKEY-AGCY
MOVE #TO-ITEM TO #PROPKEY-ITEM
FIND NUMBER PROPERTY WITH PROPKEY = #PROPKEY
IF *NUMBER > 0
ADD 1 TO #DUPLICATES
IF #DUPLICATES = 1
WRITE(1) NOTITLE '*'(40) /
'DUPLICATE RECORDS WHICH WOULD BE CREATED FOR AGENCY' #TO-AGCY ':'
END-IF
WRITE(1) NOTITLE 'ITEM #:' #TO-ITEM
END-IF
END-WORK