Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Print next line strings when a condition match

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
tgmuntor

New User


Joined: 20 May 2020
Posts: 2
Location: Brazil

PostPosted: Wed May 20, 2020 9:08 pm    Post subject: Print next line strings when a condition match
Reply with quote

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
View user's profile Send private message

Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 294
Location: Bamberg, Germany

PostPosted: Wed May 20, 2020 9:24 pm    Post subject:
Reply with quote

You should first be aware what SORT product you are using. SYNCSORT or DFSORT. icon_rolleyes.gif

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
View user's profile Send private message
tgmuntor

New User


Joined: 20 May 2020
Posts: 2
Location: Brazil

PostPosted: Wed May 20, 2020 10:32 pm    Post subject:
Reply with quote

I am using Z/OS DFSORT V2R4.
icon_biggrin.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 294
Location: Bamberg, Germany

PostPosted: Wed May 20, 2020 10:35 pm    Post subject:
Reply with quote

tgmuntor wrote:
I am using Z/OS DFSORT V2R4.
icon_biggrin.gif

Now you just need to code it in a good way.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 811
Location: Maryland

PostPosted: Wed May 20, 2020 11:30 pm    Post subject:
Reply with quote

Joerg.Findeisen wrote:
You should first be aware what SORT product you are using. SYNCSORT or DFSORT. icon_rolleyes.gif

For this particular issue there is no difference between those two.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 294
Location: Bamberg, Germany

PostPosted: Wed May 20, 2020 11:34 pm    Post subject:
Reply with quote

sergeyken wrote:
For this particular issue there is no difference between those two.

Posting in the right section of the forum perhaps? icon_wink.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 294
Location: Bamberg, Germany

PostPosted: Thu May 21, 2020 6:55 am    Post subject:
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 294
Location: Bamberg, Germany

PostPosted: Thu May 21, 2020 9:46 am    Post subject:
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2443
Location: NY,USA

PostPosted: Fri May 22, 2020 3:44 am    Post subject:
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2443
Location: NY,USA

PostPosted: Fri May 22, 2020 7:41 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Am Getting a vertical line in ISPF SC... Himansu22 TSO/ISPF 3 Fri Jul 31, 2020 11:58 pm
No new posts Force a Return Code and print error m... Rick Ryan SYNCSORT 30 Thu Jun 25, 2020 1:18 am
No new posts SQL pretty print jzhardy CLIST & REXX 7 Sun May 10, 2020 4:17 am
No new posts Submit Print Job For PDS Member With ... AllenSieracki TSO/ISPF 17 Fri Apr 10, 2020 9:31 pm
No new posts Using ICETOOL set return code as per ... Bhuvana Narasimhan DFSORT/ICETOOL 4 Fri Jan 24, 2020 12:58 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us