|
View previous topic :: View next topic
|
| Author |
Message |
sthirumalai
New User
.jpg)
Joined: 14 Aug 2007 Posts: 14 Location: Chennai
|
|
|
|
Hi,
I have a comma separated flat file of length 100 Bytes FB.
| Code: |
1675356400,660474102,201004,IP,30,C,020,594320.00,30APR2010:00:00:00
8143931500,6670187100,201006,FG,32,P,010,376161.00,04JUN2010:00:00:00
1260272500,706768100,201105,FG,43,P,020,852888.00,11MAY2011:00:00:00
1260272500,706768100,201102,FG,40,P,020,852888.00,28FEB2011:00:00:00
1260272500,706768100,201105,FG,43,C,020,852888.00,26MAY2011:00:00:00
1260272500,706768100,201102,FG,40,P,020,852888.00,24FEB2011:00:00:00
1540449400,3183366100,200910,IP,24,C,020,2237554.00,03OCT2009:00:00:00
1540449400,3183366100,201101,IP,39,C,020,2237554.00,21JAN2011:00:00:00
1540449400,3183366100,201010,IP,36,C,020,2237554.00,19OCT2010:00:00:00
1540449400,3183366100,201007,IP,33,C,020,2237554.00,12JUL2010:00:00:00
1540449400,3183366100,201001,IP,27,C,020,2237554.00,19JAN2010:00:00:00
1540449400,3183366100,200904,IP,18,C,020,2237554.00,04APR2009:00:00:00
1540449400,3183366100,200903,FG,17,C,020,2237554.00,25MAR2009:00:00:00
1540449400,3183366100,200907,IP,21,C,020,2237554.00,18JUL2009:00:00:00
1540449400,3183366100,201004,IP,30,C,020,2237554.00,30APR2010:00:00:00
5482856400,7530474101,201008,FG,34,C,030,1260101.00,09AUG2010:00:00:00
5482856400,7530474101,201010,FG,36,C,030,1260101.00,04OCT2010:00:00:00
7614698000,2823064003,200602,FG,-20,C,030,1403717.00,13FEB2006:00:00:00 |
I have to parse the above file in the following layout.
01 REC1.
05 FIELD-1 PIC X(15).
05 FIELD-1-N REDEFINES FIELD-1 PIC 9(15).
05 FIELD2 PIC X(14).
05 FIELD3 PIC X(06).
05 FIELD4 PIC X(02).
05 FIELD5 PIC S9(02).
05 FIELD6 PIC X(01).
05 FIELD7 PIC X(03).
05 FIELD8 PIC S9(9)V9(2) COMP-3.
05 FIELD9 PIC X(20).
05 FILLER PIC X(81).
Is this possible using DFsort?
Thanks & Regards
Santhosh |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
This looks very straight forward using DFSORT, Please have look at DFSORT parse function.
If you are already trying, Where are you stuck? |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Santhosh,
It's not completely clear from your description what you want the output records to look like. It would have helped if you'd shown the corresponding expected output for your input example. At any rate, you could use a DFSORT job something like this - adjust as needed to get the output you want.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=15),
%02=(ENDBEFR=C',',FIXLEN=14),
%03=(ENDBEFR=C',',FIXLEN=6),
%04=(ENDBEFR=C',',FIXLEN=2),
%05=(ENDBEFR=C',',FIXLEN=3),
%06=(ENDBEFR=C',',FIXLEN=1),
%07=(ENDBEFR=C',',FIXLEN=3),
%08=(ENDBEFR=C',',FIXLEN=12),
%09=(FIXLEN=20)),
BUILD=(%01,UFF,TO=ZD,LENGTH=15,
%02,%03,%04,%05,%06,%07,
%08,SFF,TO=PD,LENGTH=6,
%09,81X)
/*
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
| Back to top |
|
 |
sthirumalai
New User
.jpg)
Joined: 14 Aug 2007 Posts: 14 Location: Chennai
|
|
|
|
Hi Frank/Escapa,
Thanks for your help
I used the following sortcard to meet my requirement
| Code: |
SORT FIELDS=COPY
OUTREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=15),
%02=(ENDBEFR=C',',FIXLEN=14),
%03=(ENDBEFR=C',',FIXLEN=06),
%04=(ENDBEFR=C',',FIXLEN=02),
%05=(ENDBEFR=C',',FIXLEN=03),
%06=(ENDBEFR=C',',FIXLEN=01),
%07=(ENDBEFR=C',',FIXLEN=03),
%08=(ENDBEFR=C',',FIXLEN=13),
%09=(ENDBEFR=C',',FIXLEN=20)),
BUILD=(1:%01,16:%02,30:%03,36:%04,
38:%05,SFF,TO=FS,LENGTH=2,
40:%06,41:%07,44:%08,SFF,TO=PD,LENGTH=6,50:%09,
70:+0,TO=PD,LENGTH=5,76X)
|
The field5 which is a signed decimal, after conversion the sign is not present.
Rest of the fields were parsed perfectly. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| The field5 which is a signed decimal, after conversion the sign is not present. |
Because you only allowed 2 output characters for it by using LENGTH=2 instead of LENGTH=3. It should be:
| Code: |
38:%05,SFF,TO=FS,LENGTH=3,
|
(I missed that it was 3 characters, not 2.) |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|