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

JCL/REXX to know GDG base name


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
stevetelo

New User


Joined: 09 Jan 2025
Posts: 1
Location: USA

PostPosted: Fri Jan 10, 2025 8:53 pm
Reply with quote

Hello, I am looking for a suggestion to develop the below (by using JCL, REXX or COBOL etc).

My requirement is -
I will get a generic GDG dataset name as input
Example: HLQ1.HLQ2.HLQ3.G001V00 or HLQ1.HLQ2.G015V00
(so basically GDG can be of 2 high level qualifier or 3 or 4 or 5)

And the process should be able to tell me the GDG base name
Example HLQ1.HLQ2.HLQ3 or HLQ1.HLQ2 etc

Need expert advise
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10891
Location: italy

PostPosted: Fri Jan 10, 2025 9:58 pm
Reply with quote

just a POC ...

not checking if the format of dsname provided is right

last seven bytes ...
letter G
three digits
letter V
two digits

Code:

/* REXX */

gdg.0 = 2
gdg.1 = "HLQ1.HLQ2.HLQ3.G001V00"
gdg.2 = "HLQ1.HLQ2.G015V00"

do i = 1 to gdg.0
  say i "base:"left(gdg.i,length(gdg.i)-8)", gen:"right(gdg.i,7)
end

exit


to get ...

Code:

1 base:HLQ1.HLQ2.HLQ3, gen:G001V00
2 base:HLQ1.HLQ2, gen:G015V00
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 743
Location: Denmark

PostPosted: Fri Jan 10, 2025 10:24 pm
Reply with quote

Not pure REXX, but have a a look at RXREALDS at harders-jensen.com

cc=RxRealDs(name,[nft])
name Relative gds or alias. Gdsrel may be positive like (+1).
The name is internally upcased and quotes are removed.
nft Returned text if name is not found. Default is a null string
The text is returned asis, not upcased.
Returns
Real name if such exists. Note that this could be the 'name' value
if the name is already the real name.
null or the nft value if name cannot be located.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1353
Location: Bamberg, Germany

PostPosted: Sat Jan 11, 2025 4:22 pm
Reply with quote

See also https://ibmmainframes.com/about69543.html how to do it with a SORT.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2159
Location: USA

PostPosted: Fri Jan 17, 2025 8:21 pm
Reply with quote

Code:
//SYSIN    DD  *                                 
 INREC PARSE=(%1=(STARTAT=C'.G',                 
                  ENDAT=C'.',                     
                  ENDBEFR=BLANKS,                 
                  FIXLEN=10)),                   
       OVERLAY=(81:%1)                           
                                                 
 SORT FIELDS=COPY                                 
                                                 
 OUTREC IFTHEN=(WHEN=(82,9,SS,EQ,C'.',           
                   OR,83,3,ZD,NE,NUM,             
                   OR,86,1,CH,NE,C'V',           
                   OR,87,2,ZD,NE,NUM),           
                OVERLAY=(50:C'--N/A--')),         
        IFTHEN=(WHEN=NONE,                       
                OVERLAY=(50:82,9))               
                                                 
 OUTFIL BUILD=(1,80)                             
                                                 
 END                                             
//*

Code:
********************************* TOP OF DATA *********************
HLQ1.HLQ2.G011V00                                G011V00           
HLQ1.HLQ2.HLQ3.G012V0X                           --N/A--           
HLQ1.HLQ2.HLQ3.HLQ4.G013V00                      G013V00           
HLQ1.HLQ2.HLQ3.HLQ4.HLQ5.G014V0X                 --N/A--           
HLQ1.HLQ2.HLQ3.HLQ4.HLQ5.HLQ6.G015V00            G015V00           
HLQ1.HLQ2.G011V00.TAIL                           --N/A--           
HLQ1.HLQ2.HLQ3.G012V00.TAIL                      --N/A--           
HLQ1.HLQ2.HLQ3.HLQ4.G013V00.TAIL                 --N/A--           
HLQ1.HLQ2.HLQ3.HLQ4.HLQ5.G014V00.TAIL            --N/A--           
HLQ1.HLQ2.HLQ3.HLQ4.HLQ5.HLQ6.G015V00.TAIL       --N/A--           
******************************** BOTTOM OF DATA *******************
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1353
Location: Bamberg, Germany

PostPosted: Sun Jan 19, 2025 2:51 pm
Reply with quote

Code:
A.B.G9999V99.G4711V00                            --N/A--

Looks like a false negative.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2159
Location: USA

PostPosted: Sun Jan 19, 2025 11:05 pm
Reply with quote

Joerg.Findeisen wrote:
Code:
A.B.G9999V99.G4711V00                            --N/A--

Looks like a false negative.

This is a case for training exercise.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 4
Search our Forums:

Back to Top