|
View previous topic :: View next topic
|
| Author |
Message |
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Hi,
I am having following record in my input file;
| Code: |
KEY FN LN DOB
100000100,JOSEPH,GORGE,28031984
200000200,WM,KRISTEN,31031984 |
In output, i have to remove "," in such a way that the KEY should start from position 1, FN(first name) should start from 11th position, LN (last name) from 31 position and DOB from 61 position.
Output will look like as follows:
| Code: |
100000100 JOSEPH GORGE 28031984
200000200 WM KRISTEN 31031984 |
I tried with FINDREP option but the output record is not in sync.
Regards
Nitin Bhargava |
|
| Back to top |
|
 |
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Forgot to mention:
Lenght of the file is 1000, its a FB. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| You should have a look at some of the many examples of PARSE in for forum. |
|
| Back to top |
|
 |
ezio vin
New User

Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
As BILL specified using PARSE function you can accomplish your requirement.
change this following code as you need
| Code: |
//**********************************************
//MERGE EXEC PGM=SORT
//**********************************************
//SYSOUT DD SYSOUT=*
//SORTIN DD *
100000100,JOSEPH,GORGE,28031984
200000200,WM,KRISTEN,31031984
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=9),
%02=(ENDBEFR=C',',FIXLEN=6),
%03=(ENDBEFR=C',',FIXLEN=7),
%04=(FIXLEN=9)),
BUILD=(%01,12:%02,20:%03,30:%04) |
output
| Code: |
********************************* TOP OF DATA **
100000100 JOSEPH GORGE 28031984
200000200 WM KRISTEN 31031984
******************************** BOTTOM OF DATA |
|
|
| Back to top |
|
 |
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
| Thanks Bill and ezio....its done |
|
| Back to top |
|
 |
srinivasulu.p
New User
Joined: 10 Jul 2012 Posts: 22 Location: india
|
|
|
|
| Nitin Bhargava wrote: |
| Thanks Bill and ezio....its done |
is that above code is working? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Why do you want to know? Did you try it? Working in what way? ezio provided it as an example, I suspect, not for a particular task stated here? |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| is that above code is working? |
Looks like you did not read the reply 1.5 hours before yours . . .
When someone posts "thanks" and "its done", they are confirming that the code is working . . .
Think how easy it would be to run your own little test  |
|
| Back to top |
|
 |
|
|