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

Select record depending upon previous record.


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

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Thu May 25, 2006 6:37 pm
Reply with quote

Hi

I have a requirement. I want to select the next record depending upon a criteria. Ex: In Ist record If 0401 is present in position 60 then I want to select next record as well as that record.

The dataset is FB and LRECL is 100
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: Thu May 25, 2006 8:49 pm
Reply with quote

Please explain in more detail what you want, and show a more complete example of the records in the input data set and what you want for output. Are you only trying to select one pair of records or more than one pair? Based on one condition for all of the pairs or different conditions for each pair? What is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Fri May 26, 2006 10:43 am
Reply with quote

Lets take the following scnario

25kL01 000000 V PHARMACY E
25 0501609864808000400000000500111111 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500222222 V 0000 000000000000Y

Here I want to pick up where PHARMACY E is there and 111111 is also present. Dependin upon this criteria I want to pick up as many pairs are present in the dataset.

RECFM is FB and LRECL is 100
Back to top
View user's profile Send private message
Vineet

New User


Joined: 14 Sep 2005
Posts: 20

PostPosted: Fri May 26, 2006 3:09 pm
Reply with quote

Hi Suzeet. I presume that the string U have gievn in the example is 1 string which has got splitted in 2 lines. If this holds true then what U can do read the String into some Temp. String which U can define in in WS.
Then using Reference Modification(for the WS string) Read PHARMACY E & 111111 in two diff. strings(Define in WS). Now read the next record & using refernce modification match the string, where ever U find the match write that record to some file & repeat the same for all teh records U read.

Thanx
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: Fri May 26, 2006 8:13 pm
Reply with quote

Suzeet,

If you have z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006), you can use this one-pass DFSORT/ICETOOL job to do what you asked for:

Code:

//S1    EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN  DD DSN=...  input file (FB/100)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(201,8,ZD) WITH(101,100) -
  USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(201:SEQNUM,8,ZD,
    209:SEQNUM,8,ZD,START=0,
    209:209,8,ZD,MOD,+2,TO=ZD,LENGTH=8)),
   IFTHEN=(WHEN=(209,8,ZD,EQ,+1,AND,32,6,CH,EQ,C'111111'),
    OVERLAY=(101:1,100,201:201,8,ZD,SUB,+1,TO=ZD,LENGTH=8))
  OUTFIL FNAMES=OUT,INCLUDE=(17,10,CH,EQ,C'PHARMACY E'),
    BUILD=(1,100,/,101,100)
/*


If you don't have the April, 2006 PTF, you can use this two-pass DFSORT/ICETOOL job:

Code:

//S2    EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN  DD DSN=...  input file (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL0)
SPLICE FROM(T1) TO(OUT) ON(201,8,ZD) WITH(101,100) -
  USING(CTL1)
/*
//CTL0CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(201:SEQNUM,8,ZD,
    209:SEQNUM,8,ZD,START=0,
    209:209,8,ZD,MOD,+2,TO=ZD,LENGTH=8)),
   IFTHEN=(WHEN=(209,8,ZD,EQ,+1,AND,32,6,CH,EQ,C'111111'),
    OVERLAY=(101:1,100,201:201,8,ZD,SUB,+1,TO=ZD,LENGTH=8))
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(17,10,CH,EQ,C'PHARMACY E'),
    BUILD=(1,100,/,101,100)
/*
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 30, 2006 12:29 pm
Reply with quote

Hi Frank,

We don't have z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) installed.

But the second solution worked superbly.

Thanks
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: Tue May 30, 2006 8:48 pm
Reply with quote

Ok. Glad I could help. I'd suggest asking your System Programmer to install the April, 2006 DFSORT PTF so you can use all of the latest DFSORT functions.
Back to top
View user's profile Send private message
NEW2MF

New User


Joined: 31 May 2006
Posts: 3

PostPosted: Wed May 31, 2006 10:01 am
Reply with quote

Hi Frank

With suzeet's dataset I have an almost simillar requirement.

I want to replace some fields in the dataset itself. Suppose following is the input file

25kL01 000000 V PHARMACY E
25 0501609864808000400000000500111111 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500222222 V 0000 000000000000Y

In the above dataset where PHARMACY is present and 111111 is present I want to change the dataset two characters to C'00'.

Is this possible?
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: Wed May 31, 2006 8:25 pm
Reply with quote

Quote:
In the above dataset where PHARMACY is present and 111111 is present I want to change the dataset two characters to C'00'.


Huh? What does "I want to change the dataset two characters to C'00'" mean? Which two characters? And do you want to change it when 'PHARMACY' is present or when 'PHARMACY E' is present? It would have helped if you showed a more complete example of possible input records, and it definitely would have helped if you'd showed the expected output records.
Back to top
View user's profile Send private message
NEW2MF

New User


Joined: 31 May 2006
Posts: 3

PostPosted: Thu Jun 01, 2006 11:39 am
Reply with quote

Suppose following is the input dataset

25kL01 000000 V PHARMACY E
25 0501609864808000400000000500111111 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500222222 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500111111 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500333333 V 0000 000000000000Y

I want where PHARMACY E and in the next record 111111 are present change first two characters of second record of the pair to 00

My output dataset should look like this

25kL01 000000 V PHARMACY E
00 0501609864808000400000000500111111 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500222222 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
00 0501609864808000400000000500111111 V 0000 000000000000Y
25kL01 000000 V PHARMACY E
25 0501609864808000400000000500333333 V 0000 000000000000Y
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: Thu Jun 01, 2006 8:52 pm
Reply with quote

New2mf,

If you have z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006), you can use this one-pass DFSORT/ICETOOL job to do what you asked for:

Code:

//S1    EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN  DD DSN=...  input file (FB/100)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
SPLICE FROM(IN) TO(OUT) ON(201,8,ZD) WITH(101,100) -
  USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(201:SEQNUM,8,ZD,
    209:SEQNUM,8,ZD,START=0,
    209:209,8,ZD,MOD,+2,TO=ZD,LENGTH=8)),
   IFTHEN=(WHEN=(209,8,ZD,EQ,+1),
    OVERLAY=(101:1,100,201:201,8,ZD,SUB,+1,TO=ZD,LENGTH=8))
  OUTFIL FNAMES=OUT,
   IFOUTLEN=100,
   IFTHEN=(WHEN=(17,10,CH,EQ,C'PHARMACY E',AND,
                 132,6,CH,EQ,C'111111'),
     BUILD=(1,100,/,C'00',103,98)),
   IFTHEN=(WHEN=NONE,
     BUILD=(1,100,/,101,100))
/*


If you don't have the April, 2006 PTF, you can use this two-pass DFSORT/ICETOOL job:

Code:

//S2    EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN  DD DSN=...  input file (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/100)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL0)
SPLICE FROM(T1) TO(OUT) ON(201,8,ZD) WITH(101,100) -
  USING(CTL1)
/*
//CTL0CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
    OVERLAY=(201:SEQNUM,8,ZD,
    209:SEQNUM,8,ZD,START=0,
    209:209,8,ZD,MOD,+2,TO=ZD,LENGTH=8)),
   IFTHEN=(WHEN=(209,8,ZD,EQ,+1),
    OVERLAY=(101:1,100,201:201,8,ZD,SUB,+1,TO=ZD,LENGTH=8))
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,
   IFOUTLEN=100,
   IFTHEN=(WHEN=(17,10,CH,EQ,C'PHARMACY E',AND,
                 132,6,CH,EQ,C'111111'),
     BUILD=(1,100,/,C'00',103,98)),
   IFTHEN=(WHEN=NONE,
     BUILD=(1,100,/,101,100))
/*
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 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
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
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top