View previous topic :: View next topic
|
Author |
Message |
Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Hello All,
I have a file from which I need to extract a number and prefix with zeroes
Code: |
"a1234-2345-7890_1","abcde"
"a1234-2345-7890_12","abcde"
"a1234-2345-7890_23","abcde"
"a1234-2345-7890_4","abcde"
"a1234-2345-7890_5","abcde"
"a1234-2345-7890_600","abcde"
"a1234-2345-7890_7","abcde"
"a1234-2345-7890_58","abcde"
|
I need to extract the number between _ and ",", and pad with zeroes, to make it 9 bytes. Till the position of _ it is fixed.
It is a FB file with lrecl as 1000.
my output should look like
Code: |
000000001
000000012
000000023
000000004
000000005
000000600
000000007
000000058
|
Thanks in Advance
Sikkandhar |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1329 Location: Bamberg, Germany
|
|
|
|
Code: |
INREC PARSE=(%=(STARTAT=C'_',FIXLEN=1),
%01=(STARTAT=NUM,FIXLEN=9)),
BUILD=(%01,SFF,M11) |
Use ABSPOS for the starting offset if you want to have it even more simplified.
Code: |
****** *************
000001 000000001
000002 000000012
000003 000000023
000004 000000004
000005 000000005
000006 000000600
000007 000000007
000008 000000058
****** ************* |
|
|
Back to top |
|
|
Sikkandhar
New User
Joined: 03 Dec 2007 Posts: 61 Location: Bangalore
|
|
|
|
Thanks Joerg |
|
Back to top |
|
|
|