View previous topic :: View next topic
|
Author |
Message |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Hi,
I have some 100+ datasets which I need to find if they are on disk or tape. So I approached my storage management team and found that the disk datasets have device type as X'3010200F'
So my idea is to have all the datasets passed instream to SORT and attach LISTCAT to them and store the entries in an output dataset.
Now I will have the below info for every dataset
Code: |
LISTCAT ENT('TEST.DSN') ALL
NONVSAM ------- TEST.DSN
IN-CAT --- BCS.GIO.VLB0102
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2013.316
RELEASE----------------2 EXPIRATION------0000.000
VOLUMES
VOLSER------------C08964 DEVTYPE------X'3010200F'
|
From the output dataset I need to extract the dataset name and prepare a list in the output something like below with 3 fields. The dataset name, DEVTYPE(fro above), DISK if DEVTYPE equal to X'3010200F' else TAPE.
Code: |
TEST.DSN X'3010200F' DISK
TEST.DSN2 X'78048081' TAPE
TEST.DSN3 X'78048092' TAPE
|
I can build sort card for attaching LIST ENT for every input dataset before it goes to IDCAMS to execute LISTCAT. But I need help in handling the output of IDCAMS since the dataset name stays in one line and it's DEVTYPE stays in another line.
Basically I need to group those 2 lines and verify the condition on DEVTYPE and build the final output record.
Can we do this using SORT?
Regards
Amar |
|
Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Use IFTHEN=(WHEN=GROUP to PUSH the DSN onto the subsequent records. IFTHEN=(WHEN=(logical-expression to identify the DEVTYPE and format your output. You can use INCLUDE COND= to get just those two records to start with for each LISTCAT output section, and then OUTFIL INCLUDE= to get the single record of the pair that you want (the first, the DSN, will not be required for your output). |
|
Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Thank you Very much Bill... |
|
Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No problem. If you can post your code, it may be helpful to someone else in the future.
I forgot to suggest RECORDS=2 on the WHEN=GROUP, You only have pairs of records, so may as well limit the extent of the PUSH. |
|
Back to top |
|
 |
expat
Global Moderator

Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Bill,
Here is the code I've designed.
Code: |
SORT FIELDS=COPY
INCLUDE COND=(1,10,SS,EQ,C'NONVSAM',OR,37,7,CH,EQ,C'DEVTYPE')
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,10,SS,EQ,C'NONVSAM'),
END=(37,7,CH,EQ,C'DEVTYPE'),PUSH=(90:17,44)),
IFTHEN=(WHEN=(37,7,CH,EQ,C'DEVTYPE',AND,52,8,CH,EQ,C'3010200F'),
BUILD=(1:90,44,C' ',26,06,C' DISK',80:X)),
IFTHEN=(WHEN=(37,7,CH,EQ,C'DEVTYPE',AND,52,8,CH,NE,C'3010200F'),
BUILD=(1:90,44,C' ',26,06,C' TAPE',80:X))
OUTFIL INCLUDE=(53,4,SS,EQ,C'TAPE,DISK'),REMOVECC,
HEADER1=(C'DATE: ',DATE,20:C'DATASETS STATUS REPORT',/,
20:C'----------------------'),
HEADER2=(C'DATASET NAME',46:C'VOLUME',53:'TYPE',
70:C'PAGE: ',PAGE=(M10,LENGTH=2),/,
1:C'------------',46:C'------',53:'----'),
TRAILER2=(20:C'***---PAGE END---***'),BUILD=(1,80) |
Expat,
That was really big code... you must have lot of patience to code that much... Or should I say you were in real good mood, like you said in that post?
Regards
Amar |
|
Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
V S Amarendra Reddy wrote: |
That was really big code... you must have lot of patience to code that much... Or should I say you were in real good mood, like you said in that post?
Regards
Amar |
You really don't need that much code. You just need to validate device type just once.
try these control cards
Code: |
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,10,SS,EQ,C'NONVSAM',OR,37,7,CH,EQ,C'DEVTYPE')
INREC IFTHEN=(WHEN=GROUP,BEGIN(1,10,SS,EQ,C'NONVSAM'),
PUSH=(81:17,44)),
IFTHEN=(WHEN=(37,7,CH,EQ,C'DEVTYPE'),
OVERLAY=(125:52,8,CHANGE=(4,C'3010200F',C'DISK'),NOMATCH=(C'TAPE')))
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
HEADER2=('DATE: ',DATE,20:'DATASETS STATUS REPORT',/,
20:'----------------------',/,
'DATASET NAME',46:C'VOLUME',53:'TYPE',
70:'PAGE: ',PAGE=(M10,LENGTH=2),/,
'------------',46:'------',53:'----'),
TRAILER2=(20:C'***---PAGE END---***'),
SECTIONS=(81,44,
TRAILER3=(81,44,46:26,7,53:125,4))
//* |
|
|
Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Kolusu,
The code has beautifully worked. I was actually expecting your response .
I have few questions on the code.
The group you used doesn't have an END. How did it realize where the group should end? Since my input has GDGs, seq files one after thye another. Eevery GDG will give all the generations and their own volumes which mean their device type.
When the output records being built are only of 80 bytes. How were you able to put data in byte 125.
Also I understood the trailer3 but not the sectiosn part. Can you please explain?
Thank you very much for the code.
Regards
Amar |
|
Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
V S Amarendra Reddy wrote: |
Kolusu,
The code has beautifully worked. I was actually expecting your response . |
Bill gave enough hints for you to work on and so I just looked at this topic after you posted the solution. It would be easier for you to work on a solution and learn about DFSORT more and we are here to optimize that code you have.
V S Amarendra Reddy wrote: |
I have few questions on the code.
The group you used doesn't have an END. How did it realize where the group should end? Since my input has GDGs, seq files one after thye another. Eevery GDG will give all the generations and their own volumes which mean their device type. |
Well you used the INCLUDE cond to only include the Dataset name and Device type records. So you will ONLY get the Dataset name records and device type records. For every Dataset name you have device type and hence the end condition is NOT required.
V S Amarendra Reddy wrote: |
When the output records being built are only of 80 bytes. How were you able to put data in byte 125. |
Look at the OUTFIL statement where I built just 80x ie spaces. That will dictate the LRECL of the output dataset. OUTFIL acts on the final phase so whatever manipulations you do beyond the lrecl you will have access to those variables. Remove the OUTFIL statement and see the sysout and you will notice that the LRECL is 128 bytes.
V S Amarendra Reddy wrote: |
Also I understood the trailer3 but not the sectiosn part. Can you please explain?
Thank you very much for the code. |
The PUSH from WHEN=GROUP has pushed the dataset name and I used Sections on that so that for every dataset name you have keybreak and we will write out the fields specified in the Trailer3. |
|
Back to top |
|
 |
V S Amarendra Reddy
Active User

Joined: 13 Sep 2006 Posts: 221 Location: USA
|
|
|
|
Thank you very much Bill, Kolusu. My questions are clarified. |
|
Back to top |
|
 |
|
|