View previous topic :: View next topic
|
Author |
Message |
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Hello,
I need to extract DSN from a list of GDG DS.
The input is of the order:
Code: |
XXXX.NN.YYYY.GnnnnVmm
XXXXXXXX.NNNN.YYYYYY.AAAAA.BBB.GnnnnVmm
XX.NNN.AAAAA.BBB.GnnnnVmm
---
---
---
and so on....
|
Expected output:
Code: |
XXXX.NN.YYYY
XXXXXXXX.NNNN.YYYYYY.AAAAA.BBB
XX.NNN.AAAAA.BBB
---
---
---
and so on....
|
This is a relatively simple task, with PARSE, but my *SORT is relatively rusty (having been away from programming for almost an year).
PARSE, ENDBEFR '.G' is not very helpful because '.G' can occur in the DSN as well, for example: XXXX.GYYYY.AAAA.BBBB.GnnnnVmm
Any assistance/guidance with keywords is much appreciated.
Aside, if I had to do it with COBOL, I'd start reading DSN in reverse, checking on space after the DSN, and simply knock off 9 bytes of data after the first character was encountered; have forgotten how to achieve this with *SORT. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
shift right (44 bytes ) shift left ( 35 bytes ) |
|
Back to top |
|
|
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Hello Enrico,
Thanks a ton, sometimes overthinking leads us astray from the simple and obvious.
Final solution, INREC, JUSTIFY SHIFT=RIGHT, OUTFIL BUILD and drop the additional bytes of data. |
|
Back to top |
|
|
|