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

Dataset attributes listing


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 220
Location: USA

PostPosted: Thu Nov 14, 2013 3:54 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Nov 14, 2013 5:51 am
Reply with quote

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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 220
Location: USA

PostPosted: Fri Nov 15, 2013 8:23 am
Reply with quote

Thank you Very much Bill...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Nov 15, 2013 1:12 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Nov 15, 2013 1:38 pm
Reply with quote

You might also want to take a look at this old beasty too

www.ibmmainframes.com/viewtopic.php?t=57406
Back to top
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 220
Location: USA

PostPosted: Fri Nov 15, 2013 8:22 pm
Reply with quote

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... icon_smile.gif 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? icon_smile.gif


Regards
Amar
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Nov 15, 2013 9:10 pm
Reply with quote

V S Amarendra Reddy wrote:
That was really big code... icon_smile.gif 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? icon_smile.gif


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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 220
Location: USA

PostPosted: Fri Nov 15, 2013 9:56 pm
Reply with quote

Kolusu,

The code has beautifully worked. I was actually expecting your response icon_smile.gif.


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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Nov 15, 2013 10:51 pm
Reply with quote

V S Amarendra Reddy wrote:
Kolusu,

The code has beautifully worked. I was actually expecting your response icon_smile.gif.


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
View user's profile Send private message
V S Amarendra Reddy

Active User


Joined: 13 Sep 2006
Posts: 220
Location: USA

PostPosted: Sat Nov 16, 2013 12:13 am
Reply with quote

Thank you very much Bill, Kolusu. My questions are clarified.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts batch SFTP job using AOPBATCH unable ... All Other Mainframe Topics 7
No new posts Reading Empty Dataset DFSORT/ICETOOL 5
No new posts Mainframe Dataset Binary or ASCII Mainframe Interview Questions 4
No new posts SPOOL to Mainframe dataset in batch mode JCL & VSAM 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top