IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to write the next record conditionaly


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sun Apr 13, 2008 7:47 am
Reply with quote

Hi Frank,

I have a similar request to the one in:

ibmmainframes.com//viewtopic.php?t=29749

ie. when a condition is met the record is written out and the next immediate record is also written out if the first byte is an S


Code:
N 4000000 LPAR     08102 13:39:03.16 JOB05823 00000094                 
N 0000000 LPAR     08102 13:39:03.41 JOB05935 00000281                 
N 0000000 LPAR     08102 13:39:04.89  JOB05935 00000281                 
S                                                       NS1           U-
N 0000000 LPAR     08102 13:39:05.22   JOB05935 00000281               
N 4000000 LPAR     08102 13:39:05.46 JOB05979 00000094                 
N 4000000 LPAR     08102 13:39:05.48 JOB05979 00000094                 
N 0000000 LPAR     08102 13:39:06.36       JOB05935 00000281           
N 0000000 LPAR     08102 13:39:07.21 JOB05935 00000281                 
S                                                       NS2           U-
N 4000000 LPAR     08102 13:39:07.68 JOB05979 00000094                 
N 4000000 LPAR     08102 13:39:07.69 JOB05979 00000094                 
S                                                                       
N 0200000 LPAR     08102 13:39:08.00 JOB06024 00000285                 
S                                                                       


In the data I have provided, whenever string JOB05935 is found it needs to be written out as well as the next record if it has an S in col1.

The result should be :-
Code:
N 0000000 LPAR     08102 13:39:03.41 JOB05935 00000281                 
N 0000000 LPAR     08102 13:39:04.89  JOB05935 00000281                 
S                                                       NS1           U-
N 0000000 LPAR     08102 13:39:05.22   JOB05935 00000281               
N 0000000 LPAR     08102 13:39:06.36       JOB05935 00000281           
N 0000000 LPAR     08102 13:39:07.21 JOB05935 00000281                 
S                                                       NS2           U-


The position of string JOB05935 is unknown.

Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Apr 14, 2008 10:23 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN   DD    *
COPY FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(T1) TO(OUT) ON(81,8,ZD) KEEPBASE KEEPNODUPS -
  WITHALL WITH(1,96) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,80,SS,EQ,C'JOB05935'),
                OVERLAY=(81:SEQNUM,8,ZD,97:C'Y')),
        IFTHEN=(WHEN=NONE,
                OVERLAY=(89:SEQNUM,8,ZD,
                         81:81,8,ZD,SUB,89,8,ZD,TO=ZD,LENGTH=8))
  OUTREC OVERLAY=(89:SEQNUM,8,ZD,RESTART=(81,8))
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,
   INCLUDE=((89,8,ZD,EQ,+1,AND,97,1,CH,EQ,C'Y'),OR,
    (89,8,ZD,EQ,+2,AND,97,1,CH,EQ,C'Y',AND,1,1,CH,EQ,C'S')),
   BUILD=(1,80)
/*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Apr 15, 2008 6:16 am
Reply with quote

Hi Frank,
it works like a charm, very handy when extracting information from the SYSLOG.

Thanks

Gerry
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top