Combine/Merge datasets with CLIST??



IBM's Command List programming language & Restructured Extended Executor

Combine/Merge datasets with CLIST??

Postby NoSleep319 » Tue Aug 27, 2013 1:00 am

I've written the following JCL to audit group access and push it out to all other systems, where PROD is the system name. I've written a huge jobcard that includes this for over 90 different systems. The job then XMITs the created dataset back to the system I sent it from and I have to RECEIVE it. My question: Does anyone know a way to combine/merge these datasets into one, while also pulling the dataset as a variable and putting it in between the dataset information so I know what access is on what system?

//VRARBLDJ PROC RSIZE=6M,
// SMALL='VANGRD.DPSEC.RA196',
// MEDIUM='VANGRD.DPSEC.RA197',
// COMMAND='XXXX.AUDIT.PROD',
// CUNIT=DISK,
// CSPACE=50
//STEP01 EXEC PGM=IEFBR14
//DELETE1 DD SPACE=(CYL,(###CSPACE,###CSPACE),RLSE),
// UNIT=###CUNIT,
// DSN=###COMMAND,
// DISP=(MOD,DELETE)
//STEP02 EXEC PGM=VRAAARB,REGION=###RSIZE
//STEPLIB DD DSN=SYS1.VANGUARD.VANLOAD,DISP=SHR
//SVSAM DD DSN=###SMALL.,DISP=SHR
//MVSAM DD DSN=###MEDIUM.,DISP=SHR
//VIPOPTS DD DSN=SYS1.VANGUARD.VANOPTS,DISP=SHR
//COMMAND DD SPACE=(CYL,(###CSPACE,###CSPACE),RLSE),
// UNIT=###CUNIT,
// DSN=###COMMAND,
// DISP=(,CATLG,DELETE),
// DCB=BLKSIZE=23440,BUFNO=50
//* DCB=BLKSIZE=23440,RETPD=001,BUFNO=50
//SYSUDUMP DD SYSOUT=*
//SYSABOUT DD SYSOUT=*
//SYSDBOUT DD SYSOUT=*
//VIPOUT DD SYSOUT=*
// PEND
//*
//GO EXEC VRARBLDJ
//STEP02.SYSIN DD * PLACE INPUT COMMAND HERE
COMMAND(REBUILD GROUP)
INCLUDE(CONNECT PERMIT)
????
COMMAND(END)
/*
//VRABATCH EXEC PGM=IKJEFT01,DYNAMNBR=25
//OUTRPT OUTPUT DEST=DEV,CLASS=*
//SYSPROC DD DSN=SYS1.SYSSOFT.CLISTLIB,DISP=SHR
//VIPOPTS DD DSN=SYS1.VANGUARD.VANOPTS,DISP=SHR
//SYSTSPRT DD SYSOUT=*,OUTPUT=(*.OUTRPT)
//SYSTSIN DD *
XMIT DEV.XXXX DA([color=#FF0000]'XXXX.AUDIT.RESULTS') [/color]
/*

Example of what I'm pulling back:

SYS1.AUDIT.PROD (dataset name)
co xxxx group(grpname)
co yyyy group(grpname)
pe 'xxxx.**' id(grpname) ac(a) g
-----------------------------------------------------------
SYS1.AUDIT.DEV (dataset name)
co xxxx group(grpname)
co yyyy group(grpname)
pe 'xxxx.**' id(grpname) ac(a) g


I want it to be in one dataset (SYS1.AUDIT.RESULTS) that looks like this:

DEV
co xxxx group(grpname)
co yyyy group(grpname)
pe 'xxxx.**' id(grpname) ac(a) g

PROD
co xxxx group(grpname)
co yyyy group(grpname)
pe 'xxxx.**' id(grpname) ac(a) g
NoSleep319
 
Posts: 21
Joined: Tue Aug 27, 2013 12:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: Combine/Merge datasets with CLIST??

 

Re: Combine/Merge datasets with CLIST??

Postby steve-myers » Tue Aug 27, 2013 6:25 am

Of course you can. It's not terribly difficult. See the "Performing file I/O" chapter in TSO/E CLISTs for your z/OS release.

By the way, you seem to be creating a lot of RACF groups or userids; I'm not sure which. Have the security supervisors signed off on this?

Another issue: the xxxx.* name in the PERMIT commands probably should be xxxx.** if you are using enhanced generic names, as most RACF shops do these days. You do not show the ADDSD commands to create the xxxx.* profiles.

You do not need the GENERIC keyword on the PERMIT commands since the profile is already generic.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Combine/Merge datasets with CLIST??

Postby NoSleep319 » Tue Aug 27, 2013 7:19 pm

Thanks, I'll look into that. I appreciate the help. And the connects and grants were really just examples. the code above that is doing a rebuild through VRA and grabbing only CO and PE from every other system. Once I can get all of the datasets combined and organized into one, I'm going to write a few different CLISTs that will clean it up and provide either the access that the group is giving, or the IDs that are connected to it, depending on what the user is wanting from the audit.
The datasets will be created directly under the individual's personal datasets, so there's no need for any permissions, plus the creates the dataset if it doesn't exist, and deletes and creates it if it does already exist.
NoSleep319
 
Posts: 21
Joined: Tue Aug 27, 2013 12:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: Combine/Merge datasets with CLIST??

Postby NoSleep319 » Tue Aug 27, 2013 9:43 pm

ok, so this is what I've come up with...

allocate file(ilio01) da('rjyw.audit.ilio01') shr
allocate file(rosa02) da('rjyw.audit.rosa02') shr
OPENFILE ILIO01
set header=ROSA02
PUTFILE HEADER
CLOSFILE ILIO01
OPENFILE ROSA02
SET COUNTER=1
DO WHILE &COUNTERĀ¬> 3
GETFILE ROSA02
SET LINE&COUNTER=&ROSA02
SET COUNTER=&COUNTER+1
END
CLOSFILE ROSA02
OPENFILE ILIO01 UPDATE
SET COUNTER=1
DO WHILE &COUNTERĀ¬> 3
PUTFILE LINE&COUNTER
SET COUNTER=&COUNTER+1
END
CLOSFILE ILIO01

when I run it, it comes back with 'rjyw. not found'. i've modified the clist to be 'audit.ilio01' thinking it was trying to use a prefix ('rjyw.rjyw.audit.ilio01'), but still getting the same error message...the datasets exist. Any other tips???
NoSleep319
 
Posts: 21
Joined: Tue Aug 27, 2013 12:45 am
Has thanked: 0 time
Been thanked: 0 time

Re: Combine/Merge datasets with CLIST??

Postby steve-myers » Tue Aug 27, 2013 11:13 pm

Unfortunately, I do file I/O in CLISTs so infrequently I have to relearn it every time.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Combine/Merge datasets with CLIST??

Postby Peter_Mann » Wed Aug 28, 2013 12:57 am

there's 2 things you can do
1) turn on tracing to see any allocation and syntax error in the code
CONTROL LIST CONLIST SYMLIST END(ENDO) or
2) check the existance of the file prior to allocation and trace
SET W = &SYSDSN('&RDSN')   
    IF &W = OK THEN DO
    your allocation +
   ELSE DO                                         
  IF &STR(&W) = &STR(DATASET NOT FOUND) THEN DO
     WRITE &W &RDSN                             
   ENDO   

also just a tip when GETFILE and PUTFILE you really need to check the return code to see if you've reached EOF

Example
 AGAIN: -                                                       
 SET EOF=OFF                                                     
 CONTROL NOMSG NOLIST NOCONLIST NOSYMLIST END(ENDO)             
 ERROR +                                                         
   DO                                                           
    SET RCODE=&LASTCC                                           
    IF &RCODE=400 THEN +                                         
     DO                                                         
      CLOSFILE ISPFIN                                           
      CLOSFILE ISPFOUT                                           
      FREE F(ISPFIN ISPFOUT)                                     
      SET EOF=ON                                                 
      RETURN                                                     
     ENDO                                                       
    ELSE +                                                       
    RETURN                                                       
    ENDO                                                         
 GETIT: GETFILE ISPFIN                                           
 IF &EOF=ON THEN GOTO DONE                                       
 OPENFILE ISPFOUT OUTPUT                   
Peter
Peter_Mann
 
Posts: 139
Joined: Fri Jun 24, 2011 7:37 pm
Location: Lowell,AR
Has thanked: 14 times
Been thanked: 3 times

Re: Combine/Merge datasets with CLIST??

Postby Pedro » Wed Aug 28, 2013 1:14 am

I recommend using REXX programs rather than CLIST.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post