View previous topic :: View next topic
|
Author |
Message |
hithamanu
New User
Joined: 07 Jan 2011 Posts: 4 Location: Chennai
|
|
|
|
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
|
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
Back to top |
|
|
hithamanu
New User
Joined: 07 Jan 2011 Posts: 4 Location: Chennai
|
|
|
|
Thanks for the reply. I will try with this option. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
hithamanu
New User
Joined: 07 Jan 2011 Posts: 4 Location: Chennai
|
|
|
|
Thanks a lot for the replies....
I tried the function LEFT(<VARIABLE>,Len) and it worked.. |
|
Back to top |
|
|
|