Reputation: 11
I'm trying to write a JCL that check if the input file record is sorted and if not it should abend with a specific message.
This is the job that I have; but I don't want it to sort anymore. I want it to abend if company number in column 3 not in Sequence;
//TOOL1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=T
//DFSMSG DD SYSOUT=T
//TOOLIN DD *
DATASORT FROM(INPUT1) TO(OUTPUT) HEADER TRAILER USING(CTL1)
/*
//INPUT1 DD DSN=FCGL.BPYP667.CNTL(GLGLJ010),
// DISP=SHR
//OUTPUT DD DSN=FCGL.BPYP667.CNTL(GLGLJ010),
// DISP=SHR,
// DCB=*.INPUT1
//CTL1CNTL DD *
SORT FIELDS=(3,4,CH,A)
/*
Upvotes: 0
Views: 986
Reputation: 1269
(This is just a pseudo code of a fake merge, so please ignore any syntax errors if any),
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=YOUR-INP-DSN,DISP=SHR
//SORTOUT DD DSN=&&TEMP1,DISP=SHR
//SYSIN DD *
OUTREC=(1:3,1)
/*
//STEP2 EXEC PGM=SORT
//SORTIN01 DD DSN=&&TEMP1,DISP=SHR
//SORTOUT DD DUMMY or NULLFILE
//SYSIN DD *
MERGE FIELDS=COPY
/*
here STEP2 will fail if your input file not in sequence.
Upvotes: 0