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 

Reformatting input file

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


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Tue Jan 25, 2011 3:29 pm    Post subject: Reformatting input file Reply with quote

Hi

I am having an input file which is FB and 80 byte length. From that I need to create the output of 80 byte as mentioned below. Maximum no. of input records will be 5. Always the first record will be given in courtesy. Is it possible to do with sort?

Input:

Code:
ABG-SERVICES(5MEMBERS)
MARS-EXECUTIVES(7MEMBERS)
ZER-INSTITUTE(9MEMBERS)


Output:

Code:
SERVICE CATEGORY   : ABG-SERVICES
EXECUTIVE CATEGORY : MARS-EXECUTIVES
INSTITUTE CATEGORY : ZER-INSTITUTE

MEMBER LIST:

    ABG  : '5MEMBERS'
    MARS : '7MEMBERS'
    ZER  : '9MEMBERS'
*********************
COURTESY : ABG-SERVICES.


Thanks!
One.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jan 25, 2011 4:50 pm    Post subject: Reply with quote

oneofspace,

Concatenate the same file twice and use the following DFSORT JCL to get the desired results

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
$$                                                                 
//         DD *                                                   
ABG-SERVICES(5MEMBERS)                                             
MARS-EXECUTIVES(7MEMBERS)                                         
ZER-INSTITUTE(9MEMBERS)                                           
//         DD *                                                   
$$                                                                 
//         DD *                                                   
ABG-SERVICES(5MEMBERS)                                             
MARS-EXECUTIVES(7MEMBERS)                                         
ZER-INSTITUTE(9MEMBERS)                                           
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),               
  PUSH=(81:ID=1,SEQ=1)),                                           
  IFTHEN=(WHEN=INIT,PARSE=(%01=(ENDBEFR=C'-',FIXLEN=8),           
                           %02=(ENDBEFR=C'(',FIXLEN=15),           
                           %03=(ENDBEFR=C')',FIXLEN=8)),           
   BUILD=(%02,C' CATEGORY ',31:%01,%02,61:%03,81:81,2))           
                                                                   
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(81,2,ZD,EQ,12),PUSH=(83:31,25)),
  IFTHEN=(WHEN=INIT,OVERLAY=(83:83,25,SQZ=(SHIFT=LEFT,MID=C'-'))) 
                                                                   
  OUTFIL REMOVECC,IFOUTLEN=80,                                     
  OMIT=(81,1,ZD,EQ,1,AND,31,2,CH,EQ,C'$$'),                       
  IFTHEN=(WHEN=(81,1,ZD,EQ,1,AND,31,2,CH,NE,C'$$'),               
  BUILD=(01,29,SQZ=(SHIFT=LEFT,MID=C' '),C': ',                   
         31,25,SQZ=(SHIFT=LEFT,MID=C'-'))),                       
  IFTHEN=(WHEN=(81,1,ZD,EQ,2,AND,31,2,CH,EQ,C'$$'),               
  BUILD=(/,C'MEMBER LIST:',/)),                                   
  IFTHEN=(WHEN=(81,1,ZD,EQ,2,AND,31,2,CH,NE,C'$$'),               
  BUILD=(05:31,8,15:C': ''',61,9,JFY=(SHIFT=LEFT,TRAIL=C''''))),   
  TRAILER1=(25'*',/,C'COURTESY ',15:C': ',83,25)                   
//*


The output from this job is

Code:

SERVICES CATEGORY            : ABG-SERVICES   
EXECUTIVES CATEGORY          : MARS-EXECUTIVES
INSTITUTE CATEGORY           : ZER-INSTITUTE 
                                             
MEMBER LIST:                                 
                                             
    ABG       : '5MEMBERS'                   
    MARS      : '7MEMBERS'                   
    ZER       : '9MEMBERS'                   
*************************                     
COURTESY      : ABG-SERVICES                 

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
oneofspace
Beginner


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Thu Jan 27, 2011 9:02 am    Post subject: Reply with quote

Thanks Kolusu!

One.
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