|
View previous topic :: View next topic
|
| Author |
Message |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
i am getting data file from source which is | delimited.
need to count the number of delimiters from each record and if delimiter's count is plus one from other record's count then create seperate file and put record (which has plus one delimiter) in separate file and rest of the records in other file. could any one please suggest how it can be done? |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Do you have constant count of the delimiter expected and if it is not then needs to be written in seperate output? |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
yes that is correct
example every record shoudl only have 10 delimiter
if its 11 in any then it needs to be written in a seperteoutput file |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
pema_yozer,
use the following DFSORT JCL. I assumed the file to be FB recfm and 80 bytes length and the delimiter is semicolon. If your input has more than 10 delimiters it will be written to OUT2 and OUT1 file will have records with less than or equal to 10 delimiters
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1B7HC16Y9X3333339,,,,,,,,,,,,,
2001,PONTIAC,FIREBIRD,,,,,,,,,
2G2GGIK81333666,,,,,,,,,,,,,,,
4Y756JUKOD6767666653666,,,,,,,
1990,BENZ,CORVETTE,,,,,,,,,,,,
1C7HBAS805L510444,,,,,,,,,,,,,
1975,INTERNATIONAL,MODEL,1111,
8VRTT,43333666789,,,,,,,,,,,,,
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC PARSE=(%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%1=(STARTAT=C',',FIXLEN=1)),
OVERLAY=(81:%1)
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C' '),BUILD=(1,80)
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,80)
//* |
|
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
| if data file is not FB i.e if it is variable length then also your suggetsed solution will work or not? |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| pema_yozer wrote: |
| if data file is not FB i.e if it is variable length then also your suggetsed solution will work or not? |
No It might not.
Thats why, you need to tell your ALL requirements very clearly.
Now again,
if file is VB what is LRECL? |
|
| Back to top |
|
 |
pema_yozer
New User

Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
| LRECL=436 |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
pema_yozer,
You could have saved a lot of your time as well as other people's time if you had specified your requirements clearly in the first post itself. Even now there is a guess work as to what the delimiter is.
try this DFSORT JCL
| Code: |
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input VB 436 file,DISP=SHR
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC PARSE=(%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%=(STARTAT=C','),
%1=(STARTAT=C',',FIXLEN=1)),
BUILD=(1,4,%1,5)
OUTFIL FNAMES=OUT1,INCLUDE=(5,1,CH,EQ,C' '),BUILD=(1,4,6)
OUTFIL FNAMES=OUT2,SAVE,BUILD=(1,4,6)
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|