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

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


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8797
Location: Welsh Wales

PostPosted: Thu Nov 28, 2013 5:47 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Nov 28, 2013 5:57 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Nov 28, 2013 7:15 pm
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Thu Dec 05, 2013 7:43 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top