|
View previous topic :: View next topic
|
| Author |
Message |
bhaskar_kanteti
Active User
Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
|
|
|
|
Hi,
I have uploaded notepad into mainframes which is having account number and 3 amounts. I want to reformat the amounts as shown below.
No specific positions between amounts except the space delimeter.
I want to convert each amount to 15 bytes removing decimal and filling zeroes.
Input File:
| Code: |
100001 2342.34 1221.30 0
100002 423.25 523.12 9.23
100003 78.48 8.75 1.10
|
Output File:
| Code: |
100001 000000000234234 000000000122130 000000000000000
100002 000000000042325 000000000052312 000000000000923
100003 000000000007848 000000000000875 000000000000110
|
Please let me know how to achive the above output.
Thanks,
Bhaskar |
|
| Back to top |
|
 |
sriram.mukundan
New User
Joined: 20 Nov 2007 Posts: 28 Location: chennai
|
|
|
|
| these datas are generally delimited by the tab delimiter and postion may vary from record to record ? |
|
| Back to top |
|
 |
bhaskar_kanteti
Active User
Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
|
|
|
|
Hi Sriram,
Yes. What you said is correct. They will be delimited by tab and vary from record to record.
Thanks,
Bhaskar |
|
| Back to top |
|
 |
ajay_diaz Warnings : 1 New User
Joined: 12 Sep 2005 Posts: 28
|
|
|
|
Try this :
| Code: |
//STEP01 EXEC PGM=SORT
//SORTIN DD *
100001 2342.34 1221.30 0
100002 423.25 523.12 9.23
100003 78.48 8.75 1.10
//SORTOUT DD SYSOUT = *
//SYSIN DD *
OUTREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=6),
%02=(ENDBEFR=C' ',FIXLEN=15),
%03=(ENDBEFR=C' ',FIXLEN=15),
%04=(FIXLEN=15)),
BUILD=(%01,
08:%02,SFF,EDIT=(TTTTTTTTTTTTTTT),
24:%03,SFF,EDIT=(TTTTTTTTTTTTTTT),
40:%04,SFF,EDIT=(TTTTTTTTTTTTTTT))
SORT FIELDS=(1,6,CH,A)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Bhaskar,
In your sample data you have a zero which appears as 0 not 0.00. Can you confirm what a whole number (no decimal part) would appear as? So, one, for instance, will it appear as 1 or 1.00? If the former, you can consider rolling with what you have already. If not, then look in forum for quite similar task over last few days. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
if there are indeed tabs between fields
(as the TS indicated)
then the following will provide the solution to the TS's requirement:
| Code: |
OUTREC PARSE=(%01=(ENDBEFR=X'05',FIXLEN=6),
%02=(ENDBEFR=X'05',FIXLEN=15),
%03=(ENDBEFR=X'05',FIXLEN=15),
|
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
If you want to pad zeroes for the missing decimals then use the following DFSORT control cards
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
100001 2342.34 1221.30 1
100002 423.25 523.12 9.23
100003 78.48 8.75 1.10
100004 3.43 9.56 2.3
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=6),
%02=(ENDBEFR=C' ',FIXLEN=15),
%03=(ENDBEFR=C' ',FIXLEN=15),
%04=(ENDBEFR=C' ',ENDBEFR=C'.',FIXLEN=13),
%05=(FIXLEN=2)),
BUILD=(%01,X,
%02,SFF,M11,LENGTH=15,X,
%03,SFF,M11,LENGTH=15,X,
%04,SFF,M11,LENGTH=13,
%05)
OUTREC FINDREP=(STARTPOS=52,INOUT=(C' ',C'0'))
//* |
This will produce
| Code: |
100001 000000000234234 000000000122130 000000000000100
100002 000000000042325 000000000052312 000000000000923
100003 000000000007848 000000000000875 000000000000110
100004 000000000000343 000000000000956 000000000000230
|
|
|
| Back to top |
|
 |
bhaskar_kanteti
Active User
Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
|
|
|
|
Hi All,
Thank you so much.
The job ran fine I got the expected output.
Thanks once again.
- Bhaskar |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|