View previous topic :: View next topic
|
Author |
Message |
PRAVEEN KUMAR NY
New User
Joined: 30 May 2025 Posts: 6 Location: United States
|
|
|
|
can someone please help me with the code to generate the DSN name(GDS) and volume name for the same from the listcat output of GDG base.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
NONVSAM ---- DA23U.DB2IC1.DRSAGUA.SADDTEL.G1234V00
IN-CAT --- SYS1.MSCAPLBU.CATALOG
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2019.140
RELEASE----------------2 EXPIRATION------0000.000
ENCRYPTIONDATA
DATA SET ENCRYPTION-----(NO)
VOLUMES
VOLSER------------HV1078 DEVTYPE------X'78048081' FSEQN-
ASSOCIATIONS
GDG------DA23U.DB2IC1.DRSAGUA.SADDTEL
ATTRIBUTES
the output should be in the following foramt.
DA23U.DB2IC1.DRSAGUA.SADDTEL.G1234V00 HV1078
Thank you. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
Code: |
//SYSIN DD *
INCLUDE COND=(1,8,CH,EQ,C'NONVSAM')
INREC PARSE=(%1=(STARTAFT=C'---- ',
ENDBEFR=BLANKS,
FIXLEN=44)),
BUILD=(%1,80:X)
SORT FIELDS=COPY
END
//* |
But: verify your actual input listing attributes: RECFM, and LRECL.
If RECFM=VB or VBA, the positions in PARSE and INCLUDE may need adjustment. |
|
Back to top |
|
 |
PRAVEEN KUMAR NY
New User
Joined: 30 May 2025 Posts: 6 Location: United States
|
|
|
|
Hello sergeyken,
Thanks for the code.
This only generates the dataset name from listcat output, I need the volume name also. The NONVSAM keyword start at 5 column and (5,7) and the volume name starts at 9th column (9,6). The volume name should be pushed to the same line where the dataset name is printed.
DSN VOLSER
DA23U.DB2IC1.DRSAGUA.SADDTEL.G1234V00 HV1078
Thank you. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
PRAVEEN KUMAR NY wrote: |
Hello sergeyken,
Thanks for the code.
This only generates the dataset name from listcat output, I need the volume name also. The NONVSAM keyword start at 5 column and (5,7) and the volume name starts at 9th column (9,6). The volume name should be pushed to the same line where the dataset name is printed.
DSN VOLSER
DA23U.DB2IC1.DRSAGUA.SADDTEL.G1234V00 HV1078
Thank you. |
1. If you read my post carefully, I mentioned it specifically: YOU MAY NEED TO ADJUST POSITIONS DEPENDING ON YOUR OWN FILE ATTRIBUTES. Consider this as homework for yourself.
2. Use my sample as a template, to extract also VOLSER if you need it.
Hint 1: first of all try to extract DSN and VOLSER as two separate lines.
Hint 2: use also IFTHEN=(WHEN=GROUP construction, to combine both into the same lime.
3. This is a help forum, not Do-My-Job-For-Me-In-Full forum. |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1390 Location: Bamberg, Germany
|
|
|
|
Consider that you can have MultiVol as well. How you want to format the output in such cases? |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
P.S.
Always use the Code button to present any of your code sample, and/or data sample! |
|
Back to top |
|
 |
PRAVEEN KUMAR NY
New User
Joined: 30 May 2025 Posts: 6 Location: United States
|
|
|
|
I have a big list of GDG base files(8500+) for which I have to get the GDS file and volume name. By default the output is getting created in VBA format. I copy the output file to a new file with FB and used the below code to extract the NONVSAM and VOLSER name.
[code]:
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=LISTCAT.OUTPUT.FB80
//SORTOUT DD DISP=SHR,DSN=LISTCAT.OUTPUT.FB80.OUT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=((5,7,CH,EQ,C'NONVSAM'),OR,
(9,5,CH,EQ,C'VOLSER'))
/*
really not sure why I am getting the output in this format.
[img]:
[/img]
I tried the same code with 5 GDG base listcat output and it produced the proper output. can someone help me understand the reason for this.
thank you. |
|
Back to top |
|
 |
PRAVEEN KUMAR NY
New User
Joined: 30 May 2025 Posts: 6 Location: United States
|
|
|
|
Code: |
:
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 0 tNONVSAM--DW01R.IC1.DW01A6DP.G1226V00 tNONVSAM--DW01R.IC1.DW01A6DP.G
000002 0 tNONVSAM--DW01R.IC1.DW01A6DP.G1268V00 tNONVSAM--DW01R.IC1.DW01A6DP.G
000003 0 tNONVSAM--DW01R.IC1.DW01A6DP.G1310V00 tNONVSAM--DW01R.IC1.DW01A6DP.G
000004 LUMESâ eVOLSER: -eUD7523 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000005 Ø0 gNONVSAM : - ªDW01R.IC1.DW01A6DP.G1233V00 ¤IN-CAT --- SYS1.MSCAPLBU.
000006 LUMESâ eVOLSER: -eHV8814 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000007 Ø0 gNONVSAM : - ªDW01R.IC1.DW01A6DP.G1313V00 ¤IN-CAT --- SYS1.MSCAPLBU.
000008 LUMESâ eVOLSER: -eVI2869 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000009 Ø0 gNONVSAM : - ªDW01R.IC1.DW01A6DP.G1393V00 ¤IN-CAT --- SYS1.MSCAPLBU.
000010 LUMESâ eVOLSER: -eVI1797 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000011 LUMESâ eVOLSER: -eUA3905 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000012 Ø0 gNONVSAM : - ªDW01R.IC1.DW0116DD.G0423V00 ¤IN-CAT --- SYS1.MSCAPLBU.
000013 0 tNONVSAM--DW01R.IC1.DW0115DP.G0392V00 tNONVSAM--DW01R.IC1.DW0115DP.G
000014 0 tNONVSAM--DW01R.IC1.DW0115DP.G0434V00 tNONVSAM--DW01R.IC1.DW0115DP.G
000015 LUMESâ eVOLSER: -eUA4013 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000016 Ø0 gNONVSAM : - ªDW01R.IC1.DW0115DP.G0414V00 f1IDCAMS þSYSTEM SERVICES ð
000017 LUMESâ eVOLSER: -eHV2040 fDEVTYPE: -«X'78048081' dFSEQN: - »ASSOCIATIONS
000018 Ø0 gNONVSAM : - ªDW01R.IC1.DW0115DP.G0452V00 ¤IN-CAT --- SYS1.MSCAPLBU.
|
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1390 Location: Bamberg, Germany
|
|
|
|
During your conversion you seem to have borked the input. Sort can convert this for you. Focus on getting the correct output, and answer my question please.
Your input dataset, not file, should be VBA;125 |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
1. Always use the Code button to present any of your code sample, and/or data sample!
PRAVEEN KUMAR NY wrote: |
I have a big list of GDG base files(8500+) for which I have to get the GDS file and volume name. By default the output is getting created in VBA format. I copy the output file to a new file with FB and used the below code to extract the NONVSAM and VOLSER name.
Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=LISTCAT.OUTPUT.FB80
//SORTOUT DD DISP=SHR,DSN=LISTCAT.OUTPUT.FB80.OUT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=((5,7,CH,EQ,C'NONVSAM'),OR,
(9,5,CH,EQ,C'VOLSER'))
/* |
really not sure why I am getting the output in this format.
[img]:
[/img]
I tried the same code with 5 GDG base listcat output and it produced the proper output. can someone help me understand the reason for this.
thank you. |
2. There is absolutely no need to convert your EXISTING LISTING DATASET to a different format. Just opposite: you need to ADJUST YOUR PROCESSING STATEMENTS to your existing input format!!!!!!
3. Before trying to process your 8500+ production datasets, as I have suggested, train yourself on 1-2 test dataset names, to properly extract and to properly format the required data from your input LISTCAT listing.
4. People here are trying to give you advices, how you can reach your goal, step by step. Instead of following the advices you continue following your own way. If so, there is no need to post at this forum.  |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1390 Location: Bamberg, Germany
|
|
|
|
Another dead horse it seems. It was fun to try myself with LISTC ENT/LVL VOL/ALL combinations as it was unclear what the TS had used initially. |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
Maybe after all, it may help to some smart people.
Code: |
//SYSIN DD *
INCLUDE COND=(5,80,SS,EQ,L(C'NONVSAM ------- ',
C' VOLSER--------'))
INREC IFTHEN=(WHEN=(5,80,SS,EQ,C'NONVSAM ------- '),
PARSE=(%1=(STARTAFT=C'NONVSAM ------- ',
ENDBEFR=BLANKS,
FIXLEN=44)),
BUILD=(1,4,C'1',%1)),
IFTHEN=(WHEN=(5,80,SS,EQ,C' VOLSER-------'),
PARSE=(%2=(ABSPOS=5,
STARTAFT=C'VOLSER------------',
ENDBEFR=BLANKS,
FIXLEN=6)),
BUILD=(1,4,C'2',44X,X,%2))
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=GROUP,
BEGIN=(5,1,CH,EQ,C'1'),
PUSH=(6:6,44))
OUTFIL INCLUDE=(5,1,CH,NE,C'1'),
VTOF,REMOVECC,
BUILD=(X,6,44,3X,51,6,80:X)
END
//* |
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1390 Location: Bamberg, Germany
|
|
|
|
Sample should work with all kind of entries that list with at least one VOLSER. Candidate volumes are omitted. No deduplication. Please verify before using.
Code: |
INCLUDE COND=((5,1,CH,EQ,C'0',AND,6,3,CH,NE,C'IDC',AND,
6,1,SS,EQ,C'ABCDEFGHIJKLMNOPQRSTIVWXYZ'),OR,
(5,11,CH,EQ,C'0 NONVSAM'),OR,
(13,9,CH,EQ,C'VOLSER---',AND,35,2,CH,NE,C'-*'))
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(13,9,CH,NE,C'VOLSER---'),PUSH=(67:22,44))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(13,9,CH,EQ,C'VOLSER---'),
REMOVECC,VTOF,NULLOFL=RC4,
BUILD=(67,44,X,31,6,80:X)
END |
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1390 Location: Bamberg, Germany
|
|
|
|
Minor update, the string should be of course like this:
Code: |
6,1,SS,EQ,C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),OR, |
|
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
Sample should work with all kind of entries that list with at least one VOLSER. Candidate volumes are omitted. No deduplication. Please verify before using.
Code: |
INCLUDE COND=((5,1,CH,EQ,C'0',AND,6,3,CH,NE,C'IDC',AND,
6,1,SS,EQ,C'ABCDEFGHIJKLMNOPQRSTIVWXYZ'),OR,
(5,11,CH,EQ,C'0 NONVSAM'),OR,
(13,9,CH,EQ,C'VOLSER---',AND,35,2,CH,NE,C'-*'))
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(13,9,CH,NE,C'VOLSER---'),PUSH=(67:22,44))
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(13,9,CH,EQ,C'VOLSER---'),
REMOVECC,VTOF,NULLOFL=RC4,
BUILD=(67,44,X,31,6,80:X)
END |
|
This post is good for those who wants to copy-and-paste a ready solution.
It is not so good for those who would like to learn and to understand something new. There are not so many of them, but still... |
|
Back to top |
|
 |
PRAVEEN KUMAR NY
New User
Joined: 30 May 2025 Posts: 6 Location: United States
|
|
|
|
I tried with the code you suggested but the JCL failed with the following error.
Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=PN8242.LISTCAT.OUTPUT2.D110625.VB
//SORTOUT DD DISP=SHR,DSN=PN8242.LISTCAT.OUTPUT2.D110625.VB.OUT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=((9,7,CH,EQ,C'NONVSAM'),OR,(13,9,CH,EQ,C'VOLSER---'))
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(13,9,CH,NE,C'VOLSER---'),PUSH=(67:22,44))
SORT FIELDS=COPY
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(13,9,CH,EQ,C'VOLSER---'),
REMOVECC,VTOF,NULLOFL=RC4,
BUILD=(67,44,X,31,6,255:X)
END
|
WER108I SORTIN : RECFM=VB ; LRECL= 255; BLKSIZE= 27998
WER073I SORTIN : DSNAME=PN8242.LISTCAT.OUTPUT2.D110625.VB
WER257I INREC RECORD LENGTH = 255
WER202A SORTOUT RECFM INCOMPATIBLE
WER110I SORTOUT : RECFM=VB ; LRECL= 255; BLKSIZE=
WER074I SORTOUT : DSNAME=PN8242.LISTCAT.OUTPUT2.D110625.VB.OUT
WER578I SORTL INSTRUCTION NOT USED; REASON CODE=E3
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2218 Location: USA
|
|
|
|
PRAVEEN KUMAR NY wrote: |
I tried with the code you suggested but the JCL failed with the following error.
Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=PN8242.LISTCAT.OUTPUT2.D110625.VB
//SORTOUT DD DISP=SHR,DSN=PN8242.LISTCAT.OUTPUT2.D110625.VB.OUT
//SYSOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=((9,7,CH,EQ,C'NONVSAM'),OR,(13,9,CH,EQ,C'VOLSER---'))
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(13,9,CH,NE,C'VOLSER---'),PUSH=(67:22,44))
SORT FIELDS=COPY
OUTFIL FNAMES=(SORTOUT),
INCLUDE=(13,9,CH,EQ,C'VOLSER---'),
REMOVECC,VTOF,NULLOFL=RC4,
BUILD=(67,44,X,31,6,255:X)
END
|
WER108I SORTIN : RECFM=VB ; LRECL= 255; BLKSIZE= 27998
WER073I SORTIN : DSNAME=PN8242.LISTCAT.OUTPUT2.D110625.VB
WER257I INREC RECORD LENGTH = 255
WER202A SORTOUT RECFM INCOMPATIBLE
WER110I SORTOUT : RECFM=VB ; LRECL= 255; BLKSIZE=
WER074I SORTOUT : DSNAME=PN8242.LISTCAT.OUTPUT2.D110625.VB.OUT
WER578I SORTL INSTRUCTION NOT USED; REASON CODE=E3
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
I suggest you to START THINKING A LITTLE BIT!!!
You are given several ready-to-use solutions, but still cannot do anything. My impression is: this is the first time in your life when you are faced any mainframe; isn't it?
Hint for kindergarten's students:
WER202A SORTOUT RECFM INCOMPATIBLE - that means you have created in advance the output dataset with attributes incompatible with the record attributes produced by SORT.
Possible actions:
1) create your output dataset WITH CORRECT ATTRIBUTES
2) change SORT output record formatting parameters in accordance with the attributes you have assigned for your output dataset.
3) do not create the output dataset in advance; then SORT can create it with appropriate attributes.
Moderators:
This topic deserves to be moved to the beginners forum, under "how to start working with mainframe" |
|
Back to top |
|
 |
PRAVEEN KUMAR NY
New User
Joined: 30 May 2025 Posts: 6 Location: United States
|
|
|
|
Thank you for your support. I got the required output.
Going forward I try my best to learn and code myself before posting here. Thanks again. |
|
Back to top |
|
 |
|
|