View previous topic :: View next topic
Author
Message
tgmuntor New User Joined: 20 May 2020Posts: 2 Location: Brazil
Hello Dev,
I am trying to use SYNCSORT or even ICETOOL to print out information that are placed in the next line considering that I have a INCLUDE CONDITION as described below:
Input:
Code:
002567 OPINFORETRI. ENDED A
002568 CP UPDT BY A091540 MCP RERUN APPL: EZBA
002569 12/26 11.20.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
002570 RESTART OF: EZBATCH CONFIR
CONDINTION:
Code:
INCLUDE COND=(39,03,CH,EQ,C'MCP')
Desired Information:
11/26 11.20.29 EZBATCH
The difficulties that I am having is to get the strings that are placed in the next line of the desired condition.
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1341 Location: Bamberg, Germany
You should first be aware what SORT product you are using. SYNCSORT or DFSORT.
Use INREC to start a GROUP beginning WHEN it starts with your condintion (WHEN=GROUP,BEGIN..PUSH=(..,SEQ=8)). On OUTFIL you filter for SEQ=<n>/String "RESTART OF:" and that's just it. Simple.
Back to top
tgmuntor New User Joined: 20 May 2020Posts: 2 Location: Brazil
I am using Z/OS DFSORT V2R4.
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1341 Location: Bamberg, Germany
tgmuntor wrote:
I am using Z/OS DFSORT V2R4.
Now you just need to code it in a good way.
Back to top
sergeyken Senior Member Joined: 29 Apr 2008Posts: 2147 Location: USA
Joerg.Findeisen wrote:
You should first be aware what SORT product you are using. SYNCSORT or DFSORT.
For this particular issue there is no difference between those two.
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1341 Location: Bamberg, Germany
sergeyken wrote:
For this particular issue there is no difference between those two.
Posting in the right section of the forum perhaps?
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1341 Location: Bamberg, Germany
For your given sample, this should work:
Code:
//DUMMY EXEC PGM=ICEMAN
//SORTIN DD *
OPINFORETRI. ENDED A
CP UPDT BY A091540 MCP RERUN APPL: EZBA
12/26 11.20.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
RESTART OF: EZBATCH CONFIR
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(39,3,CH,EQ,C'MCP'),END=(2,2,CSF,EQ,NUM,AND,5,2,CSF,EQ,NUM),
PUSH=(134:SEQ=8))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(134,8,CSF,EQ,NUM),
REMOVECC,NODETAIL,
TRAILER1=(2,14,X,58,8)
END
/*
Output:
Code:
12/26 11.20.29 EZBATCH
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1341 Location: Bamberg, Germany
If you have multiple instances, this should work better:
Code:
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(39,3,CH,EQ,C'MCP'),END=(2,2,CSF,EQ,NUM,AND,5,2,CSF,EQ,NUM),
PUSH=(134:39,3))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(134,3,CH,EQ,C'MCP',AND,2,2,CSF,EQ,NUM,AND,5,2,CSF,EQ,NUM),
REMOVECC,
BUILD=(2,14,X,58,8)
END
/*
Output:
Code:
12/26 11.20.29 EZBATCH
12/26 11.20.29 EZBATCH
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3076 Location: NYC,USA
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
OPINFORETRI. ENDED A
CP UPDT BY A091540 MCP RERUN APPL: EZB
12/26 11.20.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
RESTART OF: EZBATCH CONFIR
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(81,8,CH) LASTDUP USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(40,3,CH,EQ,C'MCP'),
OVERLAY=(81:+1,ADD,81,8,ZD,M11,LENGTH=8))
OUTFIL FNAMES=OUT,BUILD=(1,14,X,57,7)
//*
Output-
Code:
12/26 11.20.29 EZBATCH
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3076 Location: NYC,USA
Joerg.Findeisen wrote:
If you have multiple instances, this should work better:
Code:
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(39,3,CH,EQ,C'MCP'),END=(2,2,CSF,EQ,NUM,AND,5,2,CSF,EQ,NUM),
PUSH=(134:39,3))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(134,3,CH,EQ,C'MCP',AND,2,2,CSF,EQ,NUM,AND,5,2,CSF,EQ,NUM),
REMOVECC,
BUILD=(2,14,X,58,8)
END
/*
Output:
Code:
12/26 11.20.29 EZBATCH
12/26 11.20.29 EZBATCH
The first match for the END will stop PUSH 'MCP' and it will consider that ends the Group.
Twisted your solution- This will work for multiple instances assuming no record format changes or has many different variable to code for
Code:
//SORTIN DD *
OPINFORETRI. ENDED A
CP UPDT BY A091540 MCP RERUN APPL: EZB
12/26 11.20.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
12/26 11.20.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
RESTART OF: EZBATCH CONFIR
OPINFORETRI. ENDED A
CP UPDT BY A091540 MCP RERUN APPL: EZB
12/26 11.21.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
12/26 11.21.29 CP UPDT BY A091540 OPER JOBNAME : EZBATCH
RESTART OF: EZBATCH CONFIR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(40,3,CH,EQ,C'MCP'),
END=(1,1,CH,EQ,C' ',AND,40,3,CH,NE,C'MCP'),
PUSH=(134:40,3))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(134,3,CH,EQ,C'MCP',AND,1,1,CSF,EQ,NUM),
REMOVECC,
BUILD=(1,14,X,57,7)
END
Output-
Code:
12/26 11.20.29 EZBATCH
12/26 11.20.29 EZBATCH
12/26 11.21.29 EZBATCH
12/26 11.21.29 EZBATCH
Back to top
Please enable JavaScript!