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

Overlay with WHEN=Group not working


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

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Wed Oct 21, 2015 4:00 am
Reply with quote

Hi,

I am using following sort card to split a block of records into two files
Code:

//SYSIN DD *                                                         
  OPTION COPY                                                         
   INREC IFTHEN=(WHEN=GROUP,                                         
              BEGIN=(16,8,CH,EQ,C'B0135101'),                         
              OVERLAY=(1001,C'1'))                                   
         IFTHEN=(WHEN=GROUP,                                         
              BEGIN=(16,8,CH,EQ,C'B0135102'),                         
              OVERLAY=(1001,C'2'))                                   
   OUTFIL FILES=01,INCLUDE=(1001,1,CH,EQ,C'1'),                       
            BUILD=(1,1000)                                           
   OUTFIL FILES=02,INCLUDE=(1001,1,CH,EQ,C'2'),                       
            BUILD=(1,1000)                                           
   OUTFIL FILES=XX,                                                   
            SAVE,                                                     
            BUILD=(1,1000)                                           
/*   


Here the input file and output files having record length 1000. I am adding an unique identifier '1' or '2' at position 1001 in INREC command to a block of records using group option and in the Out files based on the unique identifier I am writing to two different files.

But my sort card is giving error at Overlay command. Could you please help me to resolve.
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: Wed Oct 21, 2015 4:34 am
Reply with quote

If you get an error, post the error message.

OVERLAY is not part of WHEN=GROUP. Use PUSH=with ID=1 (length of one).
Back to top
View user's profile Send private message
krsenthil85

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Wed Oct 21, 2015 6:12 am
Reply with quote

Hi Bill,

The GROUP function works but not getting expected result because the Group function perform auto increment after writing one block of record. For example I have input file as below

Code:
00HEADER       B0135101     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135101     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135102     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135101     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135102     
70XXXXXXX
70XXXXXXX
99TRAILER


I want to get only two output files will a block of records containing 'B0135101' in one file and the other one 'B0135102' in the second file. So the output file should be as below

Output File 1
Code:
00HEADER       B0135101     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135101     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135101     
70XXXXXXX
70XXXXXXX
99TRAILER


Output file 2:
Code:
00HEADER       B0135102     
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135102     
70XXXXXXX
70XXXXXXX
99TRAILER


Please help
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: Wed Oct 21, 2015 11:40 am
Reply with quote

OK, you didn't describe or show your data previously :-)

If you look, the last digit of your BEGIN value is 1 or 2. Use that last digit to PUSH.
Back to top
View user's profile Send private message
krsenthil85

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Wed Oct 21, 2015 11:51 pm
Reply with quote

Ok. In that case it will add '00' for both the groups containing the Key B0135101 and B0135102, since Header record for both starts with '00'. But I want to add different Group number for each set of group, then only I can write each group of record in separate file. Example I need something like below



Code:
00HEADER       B0135101             001
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135101             001
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135101             001
70XXXXXXX
70XXXXXXX
99TRAILER


00HEADER       B0135102             002
70XXXXXXX
70XXXXXXX
99TRAILER
00HEADER       B0135102             002
70XXXXXXX
70XXXXXXX
99TRAILER


Assuming last three character are PUSH record. Please help.
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 Oct 22, 2015 4:49 am
Reply with quote

This is a value: B0135101. This is the other: B0135102.

Those end in 1 and 2 respectively. You want 1 and 2 appended, respectively. So PUSH the final digit of that value.

I've no clue how you got the idea of using the record-type. Since it is the same for both your selection values, I don't see how you could have even imagined that would help.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Oct 22, 2015 6:10 am
Reply with quote

You don't need to create groups separately. You just need to identify each of them.
Code:
    OPTION COPY
    INREC IFTHEN=(WHEN=GROUP,
               BEGIN=(1,8,CH,EQ,C'00HEADER'),PUSH=(1001:16,8))
    OUTFIL FILES=01,INCLUDE=(1001,8,CH,EQ,C'B0135101'),
             BUILD=(1,1000)
    OUTFIL FILES=02,INCLUDE=(1001,8,CH,EQ,C'B0135102'),
             BUILD=(1,1000)
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 Oct 22, 2015 1:04 pm
Reply with quote

That could include RECORDS=4 (each group is shown in the example with four records) or END= for the 99 (if the groups actually aren't regular). Don't need to test the HEADER part, just the record-type.
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 PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Compare latest 2 rows of a table usin... DB2 1
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Splitting group records based on deta... DFSORT/ICETOOL 8
Search our Forums:

Back to Top