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
 

 

Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 records !

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Nov 28, 2013 5:17 pm    Post subject: Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 records !
Reply with quote

Hi,

I have an input file (LRECL=80,RECFM-FB) as shown below. I want to overlay type "08" with information from type "02" and "05" records. I have 6 character key starting at 5th position and tried using WHEN=GROUP with BEGIN=(1,2,CH,EQ,C'02') and PUSH but not getting expected results. The information on output type 08 record need to have either "X" or "Y" at 33rd position based on type "05" (error record) along with info overlayed from type "02" record.

Input:-
Code:

----+----1----+----2----+----3
02  ABCDE1 GEMINI 1971  2014 N
05  ABCDE1ERROR RECORD
08  ABCDE19801
08  ABCDE19901
02  XYZAB2 VAHINI 1969  2004 N
05  XYZAB2ERROR RECORD
08  XYZAB29702
08  XYZAB29502
08  XYZAB28902
02  EFGHI3 RAMANI 1985  1994 M
08  EFGHI39403


Output:
Code:

----+----1----+----2----+----3----+----4
02  ABCDE1 GEMINI 1971  2014 N 
05  ABCDE1ERROR RECORD
08  ABCDE19801 GEMINI 1971 2014 X
08  ABCDE19901 GEMINI 1971 2014 X
02  XYZAB2 VAHINI 1969  2004 N
05  XYZAB2ERROR RECORD
08  XYZAB29702 VAHINI 1969 2004 X
08  XYZAB29502 VAHINI 1969 2004 X
08  XYZAB28902 VAHINI 1969 2004 X
02  EFGHI3 RAMANI 1985  1994 M
08  EFGHI39403 RAMANI 1985 1994 Y


Please help.

Thanks.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Nov 28, 2013 5:47 pm    Post subject:
Reply with quote

OK, you have given us the input records and the expected output records, ( I have assumed that these are the expected output as you have not stated if these are the expected output or actual output), but not the rules of what goes where and why it goes there.

Please expand on what conditions should perform what actions.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Nov 28, 2013 5:57 pm    Post subject: Reply to: Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 r
Reply with quote

Also include the code which is giving you the incorrect results. Do 02 and 05 records always exist for a key?
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Nov 28, 2013 6:20 pm    Post subject: Reply to: Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 r
Reply with quote

Expat/Bill, these are the rules - What I gave in my first post was expected output. Type 02 and 08 always exist but type 05 does not on all.

Quote:

The information on output type 08 record need to have either "X" or "Y" at 33rd position based on type "05" (error record) along with info overlayed from type "02" record.


My code (does get me expected results):
Code:

//STEP0002 EXEC PGM=SORT                           
//SORTIN   DD *                                   
02  ABCDE1 GEMINI 1971  2014 N                     
05  ABCDE1ERROR RECORD                             
08  ABCDE19801                                     
08  ABCDE19901                                     
02  XYZAB2 VAHINI 1969  2004 N                     
05  XYZAB2ERROR RECORD                             
08  XYZAB29702                                     
08  XYZAB29502                                     
08  XYZAB28902                                     
02  EFGHI3 RAMANI 1985  1994 M                     
08  EFGHI39403                                     
//SORTOUT  DD SYSOUT=*                             
//SYSOUT   DD SYSOUT=*                             
//SYSIN    DD *                                   
 SORT FIELDS=COPY                                 
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'02'),
       PUSH=(35:12,7,19,5,25,5)),                                 
       IFTHEN=(WHEN=GROUP,                                       
               BEGIN=(1,2,CH,EQ,C'05'),                           
               END=(1,2,CH,EQ,C'08'),PUSH=(60:5,1)),             
       IFTHEN=(WHEN=(1,2,CH,EQ,C'08'),BUILD=(1,14,X,35,17,60,1)) 
 OUTREC IFTHEN=(WHEN=(60,1,CH,NE,C' '),OVERLAY=(33:C'X')),       
        IFTHEN=(WHEN=(60,1,CH,EQ,C' '),OVERLAY=(33:C'Y'))         


My output:
Code:

02  ABCDE1 GEMINI 1971  2014 N  Y GEMINI 1971 2014           
05  ABCDE1ERROR RECORD          X GEMINI 1971 2014         A 
08  ABCDE19801 GEMINI 1971 2014 Y                             
08  ABCDE19901 GEMINI 1971 2014 Y                             
02  XYZAB2 VAHINI 1969  2004 N  Y VAHINI 1969 2004           
05  XYZAB2ERROR RECORD          X VAHINI 1969 2004         X 
08  XYZAB29702 VAHINI 1969 2004 Y                             
08  XYZAB29502 VAHINI 1969 2004 Y                             
08  XYZAB28902 VAHINI 1969 2004 Y                             
02  EFGHI3 RAMANI 1985  1994 M  Y RAMANI 1985 1994           
08  EFGHI39403 RAMANI 1985 1994 Y                             


Expected Output:-
Code:

----+----1----+----2----+----3----+----4
02  ABCDE1 GEMINI 1971  2014 N 
05  ABCDE1ERROR RECORD
08  ABCDE19801 GEMINI 1971 2014 X
08  ABCDE19901 GEMINI 1971 2014 X
02  XYZAB2 VAHINI 1969  2004 N
05  XYZAB2ERROR RECORD
08  XYZAB29702 VAHINI 1969 2004 X
08  XYZAB29502 VAHINI 1969 2004 X
08  XYZAB28902 VAHINI 1969 2004 X
02  EFGHI3 RAMANI 1985  1994 M
08  EFGHI39403 RAMANI 1985 1994 Y


Thanks.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Nov 28, 2013 7:15 pm    Post subject: Reply to: Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 r
Reply with quote

I think you are quite close, so you've certainly picked up something by asking questions here :-)

Problems:

You are extending your records, which is correct, but you are not chopping them down again when you no longer need the extended data.

You have multiple 08 records per key, but you end the 05 GROUP when you get an 08.

Resolution:

Cut down the records.

END the GROUP for 02 at 08 as well.

Have a third GROUP for the 08 which PUSHes all your new data into the same place.
This should correctly populate your 08s.

Get it working and then we can make some suggestions to tighten it up.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Dec 05, 2013 1:16 pm    Post subject: Reply to: Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 r
Reply with quote

Gerry, can you please help here too.

Thanks in advance.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Dec 05, 2013 3:01 pm    Post subject:
Reply with quote

Hi Ramsri,
Use below to get what you need.
Code:


//STEP0002 EXEC PGM=SORT
//SORTIN   DD *
02  ABCDE1 GEMINI 1971  2014 N
05  ABCDE1ERROR RECORD
08  ABCDE19801
08  ABCDE19901
02  XYZAB2 VAHINI 1969  2004 N
05  XYZAB2ERROR RECORD
08  XYZAB29702
08  XYZAB29502
08  XYZAB28902
02  EFGHI3 RAMANI 1985  1994 M
08  EFGHI39403
//SORTOUT  DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
 SORT FIELDS=COPY
 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'02'),
       PUSH=(81:1,30)),
       IFTHEN=(WHEN=GROUP,
                BEGIN=(1,2,CH,EQ,C'05'),PUSH=(111:1,30))
 OUTREC IFTHEN=(WHEN=(1,2,CH,EQ,C'02',OR,1,2,CH,EQ,C'05'),
                BUILD=(1,80)),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'08',AND,85,6,CH,EQ,115,6,CH),
        BUILD=(1,16,92,18,C'X',80:X)),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'08',AND,85,6,CH,NE,115,6,CH),
        BUILD=(1,16,92,18,C'Y',80:X))
/*

Output
Code:

02  ABCDE1 GEMINI 1971  2014 N
05  ABCDE1ERROR RECORD
08  ABCDE19801  GEMINI 1971  2014 X
08  ABCDE19901  GEMINI 1971  2014 X
02  XYZAB2 VAHINI 1969  2004 N
05  XYZAB2ERROR RECORD
08  XYZAB29702  VAHINI 1969  2004 X
08  XYZAB29502  VAHINI 1969  2004 X
08  XYZAB28902  VAHINI 1969  2004 X
02  EFGHI3 RAMANI 1985  1994 M
08  EFGHI39403  RAMANI 1985  1994 Y
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Dec 05, 2013 3:02 pm    Post subject:
Reply with quote

I am back after long... I might be rusty but it is tested.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Thu Dec 05, 2013 6:33 pm    Post subject: Reply to: Overlay with IFTHEN=(WHEN=GROUP) and PUSH from 2 r
Reply with quote

Escapa, got the results with your code......thanks. this is FYI..

the SYSOUT shows below:

Code:

WER238I  POTENTIALLY INEFFICIENT USE OF INREC


Thanks again.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Dec 05, 2013 7:43 pm    Post subject:
Reply with quote

Hi Sambhaji,

Good to "see" you - wondered where you had gone . . .

Welcome back!

d
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Dec 05, 2013 8:28 pm    Post subject:
Reply with quote

Thanks Dick... icon_smile.gif I was busy learning Hadoop..


Ramsri, That is because we extended inrec to by PUSH but didnt really brought everything to output.
There is way to get away with it if you really want, I leave that upto you to work on. Do post back your finding if you think of work on.
Cluse is to parse only once rather that in inrec and outrec.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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