MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert a new record in a detail record based on a condition.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
shuko
Beginner


Joined: 08 Nov 2005
Posts: 73
Topics: 20

PostPosted: Tue May 27, 2008 7:22 am    Post subject: Insert a new record in a detail record based on a condition. Reply with quote

I have a file with header and detail records.
The header records always starts with 1 in postion 1 and detail records with 2 in position 2. The file is FB with LRECL=68.

Example of a file with header and detail records.

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-

start pos 1                      start pos 34                    start pos 66
 
1HEADER1                         xxxxxxxxxxxxxxxxxxx             
2AAAAA                           bbbbbb                          s
2WS-TITLE                        IGR CLEANUP IBNR - ACYEAR=2001  S                     
2BBBBB                           20030401                        S
2........                        ....                            .
1HEADER2                         xxxxxxxxxxxxxxxxxxx             
2AAAAA                           bbbbbb                          S
2WS-TITLE                        IGR CLEANUP IBNR - ACYEAR=2001  S 
2BBBBB                           20030401                        S
2GGGGGGG                         0                               S
2........                        ....                            .

and so on.


I want to check for all detail records with 2WS-TITLE, get the value which is in position 53-64, which is ACYEAR=2001 in the first case and insert a new details record 2ACYEAR start position 1,2001 position 34 and S in position 66 for every 2WS-TITLE found in detail record.

Expected output file

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+-

start pos 1                      start pos 34                    start pos 66
 
1HEADER1                         xxxxxxxxxxxxxxxxxxx             
2AAAAA                           bbbbbb                          s
2WS-TITLE                        IGR CLEANUP IBNR - ACYEAR=2001  S 
2ACYEAR                          2001                            S 
2BBBBB                           20030401                        S
2........                        ....                            .
1HEADER2                         xxxxxxxxxxxxxxxxxxx             
2AAAAA                           bbbbbb                          S
2WS-TITLE                        IGR CLEANUP IBNR - ACYEAR=2003  S 
2ACYEAR                          2003                            S 
2BBBBB                           20030401                        S
2GGGGGGG                         0                               S
2........                        ....                            .



Thank you
Shuko
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group