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 a 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: Mon May 31, 2010 8:55 am    Post subject: Reformatting a file. Reply with quote

Hi

I am having a fb file of length of 80 bytes. I need to takeout 4 lines in that and write it into fb output file of length 80.

I/P:
Code:
105789 raveen axis corp
   12 rajiven coordinates corp
............... *****.....................
$$$$ next set $$$$$$

0000arivind 10th grade asbiss
    ragu ms mit
~~~~~~~~~~~~~~~~~~~~~

********** list **********
** students - 2
   employees - 2
   total employees working - 2
************************
$$$$$$$$ address details $$$$$
.
.
.
.
.
 



The input file will be going on like that.

I want to have output as follows
Code:
****************************
students:
---------
********** list **********
students - 2
employees:
----------
********** list **********
employees - 2

total employees working - 2

****************************


Thanks in advance!
One.
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon May 31, 2010 11:44 am    Post subject: Reply with quote

You need to explain your "rules". . .

You have output that is not in the input - why?
_________________
All the best,

di
Back to top
View user's profile Send private message
oneofspace
Beginner


Joined: 18 Nov 2008
Posts: 33
Topics: 14

PostPosted: Tue Jun 01, 2010 2:22 am    Post subject: Reply with quote

Hi

I want to take out the following four lines from the input file and reformat as like below mentioned output. Moreover the part (Input) mentioned below can be anywhere in input file and appear once. There is no proper layout for the input file. The input file is almost like a report file.

Input:
Code:
********** list **********
** students - 2
   employees - 2
   total employees working - 2


Output:
Code:
****************************
students:
---------
********** list **********
students - 2
employees:
----------
********** list **********
employees - 2

total employees working - 2

****************************


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


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

PostPosted: Tue Jun 01, 2010 10:26 am    Post subject: Reply with quote

oneofspace,

Use the following DFSORT JCL which will give you the desired results


Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=Your input FB 80 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC IFTHEN=(WHEN=GROUP,PUSH=(81:SEQ=8,1,80),         
  BEGIN=(1,80,SS,EQ,C'********** LIST **********'))     

  OUTFIL IFOUTLEN=80,                                   
  INCLUDE=(81,8,ZD,GT,0,AND,81,8,ZD,LE,4),               
  IFTHEN=(WHEN=(81,8,ZD,EQ,1),                           
  BUILD=(80C'*',/,C'STUDENTS:',/,C'---------',/,1,80)), 
  IFTHEN=(WHEN=(81,8,ZD,EQ,3),                           
  BUILD=(C'EMPLOYEES:',/,C'----------',/,89,80,/,1,80)),
  IFTHEN=(WHEN=(81,8,ZD,EQ,4),                           
  BUILD=(80C' ',/,1,80,/,80C' ',/,80C'*'))               
//*

_________________
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