Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

z/OS USS and REXX issue

Status
Not open for further replies.

GIJeff

Programmer
May 22, 2013
1
US
Hi, I'm new to REXX but have been trying to piece together some code to manipulate USS directories. The MKDIR command under the ARCHIVE: procedure returns a RC(-20), but the MKDIR under the NEW_DIR: procedure executes flawlessly. I've tried just about everything. The only way I can get this code to work is if I remove the SYSCALL logic, which tells me that it has something to do with that???? Can anyone throw me a bone on this?

/* REXX */
/* TRACE A */

CALL CLEANUP
CALL NEW_DIR

EXIT(RC)


NEW_DIR:
/* Get yesterday's date DDMMMYYYY and create directory */
DT = SPACE(DATE(N,(DATE(B)-1),B),0)
UPPER DT
DIRECTORY="'/u/kjdy01/SAS/Perf/daily-reports/"DT"'"
mkdir DIRECTORY

RETURN

CLEANUP:
/* Check /daily-reports directory to see if we need to archive */
M=DATE(M)
/* UPPER M */
call syscalls 'ON'
address syscall
'readdir /u/kjdy01/SAS/Perf/daily-reports DAYS.'
call syscalls 'OFF'

IF SUBSTR(DAYS.3,3,3) ^= M THEN
CALL ARCHIVE

RETURN

ARCHIVE:
/* Create MMMYYYY directory in archive */
SD = SUBSTR(DAYS.3,3,7)
UPPER SD
DIRECTORY="'/u/kjdy01/SAS/Perf/archive-reports/"SD"'"
mkdir DIRECTORY

/* Move all day directories to archive directory */
D1="/u/kjdy01/SAS/Perf/daily-reports/*"
D2="/u/kjdy01/SAS/Perf/archive-reports/"SD
CMD="mv" D1 D2
CALL BPXWUNIX CMD

RETURN
 
Does DAYS.3 have a value? Remember DAYS.3 if not initialized is set to "DAYS.3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top