IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PARSE GDG name to separate generation number


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Sun Feb 11, 2018 3:40 pm
Reply with quote

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. icon_redface.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Sun Feb 11, 2018 6:09 pm
Reply with quote

shift right (44 bytes ) shift left ( 35 bytes )
Back to top
View user's profile Send private message
Abid Hasan

New User


Joined: 25 Mar 2013
Posts: 88
Location: India

PostPosted: Mon Feb 12, 2018 3:14 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top