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

Rexx file formatting


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
hithamanu

New User


Joined: 07 Jan 2011
Posts: 4
Location: Chennai

PostPosted: Wed Nov 16, 2011 11:23 am
Reply with quote

Hi

I need to format a file using REXX.

Input file

Code:
abcedfgh;23423423;10.05.1987;xx;23546
abcde;23423434;;ff;323
asdfsdf;253658;20.12.1987;t;25698

Output file should look like ::

Code:
abcedfgh;23423423;10.05.1987;xx;23546
abcde$$$;23423434;$$$$$$$$$;ff;323
asdfsdf$$;253658$$;20.12.1987;t$;25698


$ indicate spaces.

Is there anty function in REXX which I can use for this formatting?
i tried this with Parse string. But it dint give the expected output.

Can someone please help me in this?

Thanks in advance
Code:
Code:
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 16, 2011 11:41 am
Reply with quote

Hi

You should try to make use of Refer manual here

Code:


LEFT(<VARIABLE>,8)

Back to top
View user's profile Send private message
hithamanu

New User


Joined: 07 Jan 2011
Posts: 4
Location: Chennai

PostPosted: Wed Nov 16, 2011 11:55 am
Reply with quote

Thanks for the reply. I will try with this option.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Nov 16, 2011 12:14 pm
Reply with quote

Another formatting option:
When posting code etc that needs a fixed font to maintain spacing highlight the code, or whatever, in the reply box and click the Code button above the box. That will give you a nice 'green screen' effect and you would not have to put in all those $.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Nov 16, 2011 9:18 pm
Reply with quote

If the file is very large, you might want to use SORT instead of a rexx program.
The following:
Code:
//S1      EXEC  PGM=SORT                                       
//SYSOUT  DD    SYSOUT=*                                       
//SORTIN  DD    *                                             
ABCEDFGH;23423423;10.05.1987;XX;23546                         
ABCDE;23423434;;FF;323                                         
ASDFSDF;253658;20.12.1987;T;25698                             
//SORTOUT DD    SYSOUT=*                                       
//SYSIN   DD    *                                             
  OPTION COPY                                                 
  INREC PARSE=(%01=(ENDBEFR=C';',FIXLEN=8),                   
               %02=(ENDBEFR=C';',FIXLEN=8),                   
               %03=(ENDBEFR=C';',FIXLEN=10),                   
               %04=(ENDBEFR=C';',FIXLEN=2),                   
               %05=(FIXLEN=5)),                               
        BUILD=(%01,C';',%02,C';',%03,C';',%04,C';',%05,43C' ')

worked for me with SYNCSORT but should work with DFSORT as well.
Output received:
Code:
ABCEDFGH;23423423;10.05.1987;XX;23546 
ABCDE   ;23423434;          ;FF;323   
ASDFSDF ;253658  ;20.12.1987;T ;25698 
Back to top
View user's profile Send private message
hithamanu

New User


Joined: 07 Jan 2011
Posts: 4
Location: Chennai

PostPosted: Thu Nov 17, 2011 6:32 pm
Reply with quote

Thanks a lot for the replies....
I tried the function LEFT(<VARIABLE>,Len) and it worked.. icon_biggrin.gif
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Running REXX through JOB CLIST & REXX 13
Search our Forums:

Back to Top