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

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
Hi Team,
My input PS file looks like as below:-
03,0000000,,030,0,,,040,1110,,,060,0,,/
03,6000550,,030,1125414,,,040,9990,,,060,1125414,,/
03,550000,,030,0,,,040,8880,,,060,0,,/
03,7676767672,,030,0,,,040,7770,,,060,0,,/
88,072,0,,,074,0,,,100,0,0,,400,0,0,/
I need copy only bold fields into a PS file. Any pointer or any help.
Regards
Arun |
|
| Back to top |
|
 |
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
| If you have DFSORT or Syncsort, you can use its PARSE feature to get the desired output. You will find many examples in this forum. |
|
| Back to top |
|
 |
arunsoods
New User

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
Thanks for the quick response.
I have prepared a sort card given below:-
| Code: |
SORT FIELDS=COPY
INCLUDE COND=(01,2,CH,EQ,C'03',OR,01,2,CH,EQ,C'01')
INREC PARSE=(%01=(ENDBEFR=C'03,',FIXLEN=05),
%02=(ENDBEFR=C',,030,',FIXLEN=20),
%03=(ENDBEFR=C',,,040,',FIXLEN=15),
%04=(ENDBEFR=C',,,060,',FIXLEN=15),
%05=(ENDBEFR=C',,/',FIXLEN=15),
%06=(STARTAFT=C',AMERI005,',FIXLEN=06)),
BUILD=(%02,%03,%04,%05,%06) |
My input data is :-
| Code: |
01,121000248,AMERI005,170712,2200,01,080,,2/
03,0000000,,030,0,,,040,1110,,,060,0,,/
03,6000550,,030,1125414,,,040,9990,,,060,1125414,,/
03,550000,,030,0,,,040,8880,,,060,0,,/
03,7676767672,,030,0,,,040,7770,,,060,0,,/ |
My expected output
| Code: |
0 0 1110 0 170712
6000550 1125414 9990 1125414 170712
550000 0 8880 0 170712
7676767672 0 7770 0 170712 |
I am getting the correct output but last date field is not populating. Pardon me output is not displaying in correct table format.
Code'd |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Arun,
Use the code button to preserve data/code alignment.
From the data it looks like you want to propagate the date from the '01' record to all other '03' output records. Is that what you're trying to do?
How many '01' records will you have in input?
You might want to consider parsing based on the field number instead of field values (unless you're sure about it).
The idea should be to parse the variable fields to bring them to fixed positions, including the record type (01,03 etc). Then propagate the date in the first record to all the other records (use WHEN=GROUP and BEGIN when record type=01). |
|
| Back to top |
|
 |
arunsoods
New User

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
Yes Arun my requirement is same as you understood.
There will be only one '01' type of record from which we have to fetch date field and put it with each '03' type record which I am parsing.
Parsing is working fine just putting the date fetched from '01' type is not concatating with each record.
Hope you understood |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| Quote: |
| Parsing is working fine just putting the date fetched from '01' type is not concatating with each record |
Arun,
Parsing does not copy field data between records. It does not work similar to a symbol substitution. Once you have successfully parsed the data fields you want, then use a 'WHEN=GROUP...PUSH' to propagate the date field from the '01' record to your '03' records. Good luck. |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
here is the snippest code.
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
PARSE=(%00=(ENDBEFR=C',',FIXLEN=05),
%01=(ENDBEFR=C',',FIXLEN=20),
%=(ENDBEFR=C',',FIXLEN=15),
%02=(ENDBEFR=C',',FIXLEN=15),
%=(ENDBEFR=C',',FIXLEN=15),
%=(ENDBEFR=C',',FIXLEN=15),
%=(ENDBEFR=C',',FIXLEN=15),
%=(ENDBEFR=C',',FIXLEN=15),
%03=(ENDBEFR=C',',FIXLEN=15),
%=(ENDBEFR=C',',FIXLEN=15),
%=(ENDBEFR=C',',FIXLEN=20),
%=(ENDBEFR=C',',FIXLEN=20),
%04=(ENDBEFR=C',',FIXLEN=20)),
BUILD=(%00,%01,%03,%04,%02)),
IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'01'),PUSH=(61:61,6))
OUTFIL INCLUDE=(1,2,CH,NE,C'01'),BUILD=(6,70)
|
You may need to adjust positions accordingly, also you may need to have EDIT=(IIIIIIIIIIIIT).. to suppress zeros if required. |
|
| Back to top |
|
 |
arunsoods
New User

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
Hi magesh23586,
Your code snippet is not throwing the correct output can you please check. I was looking for only 03 level data and it is picking all records of the file. I have not mentioned other levels in the above input data example. Can you please help me to modify your code to data only from 03 level records:-
| Code: |
01,121111111,AMERI005,170712,2200,01,080,,2/
02,AMERI005,091000019,1,170712,,,/
03,121112111,,030,0,,,040,0,,,060,0,,/
88,072,0,,,074,0,,,100,0,0,,400,0,0,/
49,0,3/
03,121121212,,030,323241,,,040,0,,,060,323241,,/
88,072,0,,,074,0,,,100,323241,1,,400,0,0,/
49,969723,3/
03,121212122,,030,133483,,,040,0,,,060,133483,,/
88,072,0,,,074,0,,,100,133483,1,,400,0,0,/
49,400449,3/
03,121212121,,030,403254,,,040,0,,,060,403254,,/
88,072,0,,,074,0,,,100,403254,1,,400,0,0,/
|
For above mentioned input data I need below data as output:-
| Code: |
121112111 0 0 0 170712
121121212 323241 0 323241 170712
121212122 133483 0 133483 170712
121212121 403254 0 403254 170712
|
Hi Arun,
I am not able to find any good manual for the same can you please if possible provide any link to manual for the same.
Regards
Arun Sood |
|
| Back to top |
|
 |
arunsoods
New User

Joined: 13 Jul 2016 Posts: 35 Location: India
|
|
|
|
Hi magesh23586,
Thanks no Need to reply again My code ran fine and throwing expected output.
Thanks Arun, for the help.
Regards
Arun Sood |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
You must return starting position in PARSE %06 to the beginning of record:
| Code: |
%06=(ABSPOS=1, - to restart parsing from the beginning
STARTAFT=C',AMERI005,',
ENDBEFR=C',', - to handle empty or short parm, by a chance
FIXLEN=06)), |
|
|
| Back to top |
|
 |
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
| I doubt if anything was "thrown" - in these particular instances you should have used "giving" which has a completely different meaning. (Nothing is "thrown" on a mainframe.) |
|
| Back to top |
|
 |
magesh23586
Active User

Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
| Nic Clouston wrote: |
| I doubt if anything was "thrown" - in these particular instances you should have used "giving" which has a completely different meaning. (Nothing is "thrown" on a mainframe.) |
Well Said..
 |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
| arunsoods wrote: |
Hi magesh23586,
Thanks no Need to reply again My code ran fine and throwing expected output.
Thanks Arun, for the help.
Regards
Arun Sood |
Arun,
Glad you figured it out. Thanks for letting know. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|