Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Select record depending upon previous record.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Select record depending upon previous record.
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 Moderator


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

PostPosted: Thu May 25, 2006 8:49 pm    Post subject:
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    Post subject:
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: 18

PostPosted: Fri May 26, 2006 3:09 pm    Post subject: Reply
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 Moderator


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

PostPosted: Fri May 26, 2006 8:13 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue May 30, 2006 8:48 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed May 31, 2006 8:25 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Thu Jun 01, 2006 8:52 pm    Post subject:
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    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 Record Not found in AlX but record re... mukun264 COBOL Programming 0 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us