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

create two/more output records from an input


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Tue Jul 05, 2011 12:05 pm
Reply with quote

Hi all,


I have an requirement to validate a record and generate two/more output records

Input file -
Code:
00123ABC000000000111111NNY
00123ABC000000000222222YNY
00123ABC000000000333333NNY
00123ABC000000000444444NNY
00123ABC000055555555555NNY


Rules,

1. Whenever the field 26 is 'Y' create two records
2. Whenever the field 24 is 'Y' create a record
3. whenever the field (12,2) is non zero and even the 26/24 holds 'Y' build an invalid record

Output should be

Code:
1230000000111111AA0101Y             
1230000000111111AA0202Y             
1230000000222222AA0101Y             
1230000000222222AA0202Y             
1230000000222222AA0303Y             
1230000000333333AA0101Y             
1230000000333333AA0202Y             
1230000000444444AA0101Y             
1230000000444444AA0202Y             
---- INVALID RECORD --- 055555555555


I used the following code but not able to come up with the desired solution

Code:
OUTREC IFTHEN=(WHEN(12,2,CH,EQ,C'00',AND,26,1,CH,EQ,C'Y'), 
       BUILD=(1:3,3,4:C'000',7:14,10,17:C'AA0101',23:C'Y', 
             80:X),HIT=NEXT),                               
       IFTHEN=(WHEN(12,2,CH,EQ,C'00',AND,26,1,CH,EQ,C'Y'), 
       BUILD=(1:3,3,4:C'000',7:14,10,17:C'AA0202',23:C'Y', 
             80:X),HIT=NEXT),                               
       IFTHEN=(WHEN(24,1,CH,EQ,C'Y'),                       
       BUILD=(1:3,3,4:C'000',7:14,10,17:C'AA0303',23:C'Y', 
             80:X),HIT=NEXT),                               
       IFTHEN=(WHEN(12,2,CH,NE,C'00'),                     
       BUILD=(1:C' ---- INVALID RECORD --- ',33:12,12))     


Hope i explained my requirements clearly, if not please let me know what you need to know.

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

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Jul 05, 2011 3:21 pm
Reply with quote

Try this
Code:

SORT FIELDS=COPY                                             
OUTFIL IFTHEN=(WHEN(12,2,CH,EQ,C'00',AND,26,1,CH,EQ,C'Y',AND,
                    24,1,CH,EQ,C'Y'),                         
        BUILD=(1:3,3,4:C'000',7:14,10,17:C'AA0101',23:C'Y',   
             80:X,/,1:3,3,4:C'000',7:14,10,17:C'AA0202',     
             23:C'Y',80:X,/,                                 
             1:3,3,4:C'000',7:14,10,17:C'AA0303',23:C'Y',     
             80:X)),                                         
       IFTHEN=(WHEN(12,2,CH,EQ,C'00',AND,26,1,CH,EQ,C'Y',AND,
                    24,1,CH,NE,C'Y'),                         
        BUILD=(1:3,3,4:C'000',7:14,10,17:C'AA0101',23:C'Y',   
             80:X,/,1:3,3,4:C'000',7:14,10,17:C'AA0202',     
             23:C'Y',80:X)),                                 
       IFTHEN=(WHEN(12,2,CH,NE,C'00'),                       
        BUILD=(1:C' ---- INVALID RECORD --- ',33:12,12))     
                                                             


Also you have missed to include
Code:
SORT FIELDS=COPY
in the above card.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Tue Jul 05, 2011 3:56 pm
Reply with quote

Hey bharath,

Thanks for your help. With little modification the code worked perfectly.

Thanks !!!
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top