View previous topic :: View next topic
|
Author |
Message |
poongs Warnings : 1 New User
Joined: 24 Jan 2007 Posts: 28 Location: pune
|
|
|
|
Hi all
need ur help in this
my input file has many instructions and it has a LRECL=80 and the each instruction has a delimiter of "/" .I got to validate a instrn starting with some 'ZZZ' and ending with "/" but this instruction consitsts of some 4 lines.i.e,teh "/" is encountered after i ahev read teh 4th line only and also the 4 lines shud be moved to a ws-field.instead of checking byte by byte is there any other way of doing it?(i'm performing 4 reads to get teh 4 lines) and also i know that the "/" for this 'ZZZ' instrn will not be encountered in the first line itself ....i.e,more than one read is needed in this case. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Try to give several examples of your input and several examples of your expected output. |
|
Back to top |
|
|
poongs Warnings : 1 New User
Joined: 24 Jan 2007 Posts: 28 Location: pune
|
|
|
|
my input instrn has
zzz+jhdfjkshgd+sjdhfjkdshfjd+bmmnv+1234+
54542+5454+
hgadhghf+gfhdshgfj+1234+uhdfh+
jhgfhja+kjhfk+/
and i want to separate every field in tehis instrn with a delimiter of '+' and i got to get teh 13th field for storing in my table.Once i have read the whold insrtn till teh '/' i'll unstring it get the 13th filed. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I think you are already well on your way to success.
Read the 4 records in to 4 contiguous storage areas (in a row).
Unstring the 320 byte area into 12 dummy slots and the 13th one to save delimiting on both "+" and space.
Assuming the only imbeded spaces are trailing each record and not in the actual data:
UNSTRING WS-320 DELIMITED BY '+' OR ALL SPACES INTO
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-JUNK
WS-13TH
I think that might work, but I'd test it once or twice before putting it into production..... |
|
Back to top |
|
|
|