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 

2 outfiles, different layouts

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
kmohamed@fnb.co.za
Beginner


Joined: 13 Mar 2018
Posts: 1
Topics: 1
Location: South Africa

PostPosted: Thu Jun 21, 2018 6:54 am    Post subject: 2 outfiles, different layouts Reply with quote

Hi,

I have a requirement to process an input file and produce :-
1. BACKUP file (exact copy of input file)
2. FORMAT file (created from input.

My problem, is the FORMAT file works fine, however the BACKUP file is a copy of the FORMAT and not the INPUT. I'm using the BUILD instruction.
Please can someone assist.


My sysin is as follows :-
Code:

SORT FIELDS=COPY                     
  OUTFIL FNAMES=(FORMAT)             
 OUTREC IFTHEN=(WHEN=INIT,           
 BUILD=(LDDATE,                     
        001,02,FI,EDIT=(TTTT),       
        003,23,                     
        026,15,                     
        041,40,                     
        081,15,                     
        096,08,ZD,EDIT=(TTTT-TT-TT),
......
        IFTHEN=(WHEN=(514,2,CH,EQ,C'01'),         
        OVERLAY=(514:C'20'),HIT=NEXT),     
IFTHEN=(WHEN=(909,2,CH,EQ,C'01'),         
        OVERLAY=(909:C'20'),HIT=NEXT),     
IFTHEN=(WHEN=(1304,2,CH,EQ,C'01'),         
        OVERLAY=(1304:C'20'),HIT=NEXT),   
IFTHEN=(WHEN=(1699,2,CH,EQ,C'01'),         
        OVERLAY=(1699:C'20'),HIT=NEXT),   
OUTFIL FNAMES=(BACKUP)
Back to top
View user's profile Send private message Send e-mail
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Thu Jun 21, 2018 10:55 am    Post subject: Reply with quote

You may try following code UNTESTED

Code:

OPTION COPY
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(LDDATE,
                                001,02,FI,EDIT=(TTTT),
                                003,23,
                                026,15,
                                041,40,
                                081,15,
                                096,08,ZD,EDIT=(TTTT-TT-TT),
                                ......)),
       IFTHEN=(WHEN=(514,2,CH,EQ,C'01'),
               OVERLAY=(514:C'20'),HIT=NEXT),

       IFTHEN=(WHEN=(909,2,CH,EQ,C'01'),
               OVERLAY=(909:C'20'),HIT=NEXT),
       
       IFTHEN=(WHEN=(1304,2,CH,EQ,C'01'),
               OVERLAY=(1304:C'20'),HIT=NEXT),

       IFTHEN=(WHEN=(1699,2,CH,EQ,C'01'),
               OVERLAY=(1699:C'20'),HIT=NEXT),
       FNAMES=FORMAT

OUTFIL FNAMES=BACKUP



Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Thu Jun 21, 2018 12:36 pm    Post subject: Reply with quote

kmohamed@fnb.co.za,

You don't really need to use the IFTHEN statements , you can do it using CHANGE command itself. something like this
Code:

//SYSIN    DD *                                                       
  OPTION COPY                                                         
  OUTFIL FNAMES=FORMAT,                                               
         BUILD=(LDDATE,                                               
                0001,02,FI,EDIT=(TTTT),                               
                0003,23,                                               
                0026,15,                                               
                0041,40,                                               
                0081,15,                                               
                0096,08,ZD,EDIT=(TTTT-TT-TT),
                ...                         
                0514:0514,2,CHANGE=(2,C'01',C'20'),NOMATCH=(0514,2),   
                ...
                0909:0909,2,CHANGE=(2,C'01',C'20'),NOMATCH=(0909,2),   
                ...
                1304:1304,2,CHANGE=(2,C'01',C'20'),NOMATCH=(1304,2),   
                ...
                1699:1699,2,CHANGE=(2,C'01',C'20'),NOMATCH=(1699,2),
                ...)
                                                                       
  OUTFIL FNAMES=BACKUP                                                 
//*


Magesh_J,

Your IFTHEN=(WHEN=INIT would have already formatted output to a new length (LDDATE is added upfront) so your IFTHEN=(WHEN for positions 514, 909, 1304, 1699 may NOT be the right positions any more. So you need to readjust the positions of the IFTHEN look up based on the INIT formatting. So it is quite simple to avoid the whole IFTHEN statements and just stick with CHANGE.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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