Page 1 of 1

Error in rexx code execution

PostPosted: Wed Jan 26, 2011 7:11 pm
by devi
Hello

I am a newbie here and I have just started learning Rexx. I need help to execute a rexx program.
I have coded rexx program to copy the existing vsam file to a new vsam file with the same attributes of existing one. I agree file-aid can do the same functionality. I wanted to give a try.

The error is shown below:
30 *-* "DEFINE CLUSTER (NAME("'ODSN'") MODEL("'VDSN'")),
DATA (NAME("'ODSNDAT'"))"
>>> "DEFINE CLUSTER (NAME(ODSN) MODEL(VDSN)),
DATA (NAME(ODSNDAT))"
IGD01008I SC SET TO SCSHTEST
IGD01005I SC SET TO SCSHTEST
IGD01009I MC SET TO MCTSHORT, EXPIRES AFTER 30 DAYS OF NON USAGE
IDC3901I ERROR QUALIFYING A123.VDSN
IDC3902I ** DEFAULT SERVICE ROUTINE ERROR CODE 20, LOCATE ERROR CODE 8
IDC0014I LASTCC=12

Rexx code :

/* REXX */
"ISPEXEC CONTROL ERRORS RETURN"
ADDRESS ISREDIT 'MACRO'
IF RC = 0 THEN
ADDRESS ISREDIT "(VDSN) = VSAMFILE"
VAR1 = VDSN
ODSN = 'TEST.VSAM.FILE1'
ODSNDAT = 'TEST.VSAM.FILE1.DATA'

DSINFO = LISTDSI(VAR1)

IF SYSDSORG = 'VS' THEN
IF RC = 0 THEN
SAY 'VSAM FILE - ALLOC CLUSTER NOW'
ELSE
SAY 'NOT A VSAM FILE'

/* ALLOCATE FILE */

IF SYSDSN(ODSN) = 'OK' THEN
DO
IF SYSVAR(SYSISPF) \= 'ACTIVE' THEN
DO
SAY 'DATASET ' ODSN ' CATALOGED. INITIATING COPY'
END
END

DO
"DEFINE CLUSTER (NAME("'ODSN'") MODEL("'VDSN'")),
DATA (NAME("'ODSNDAT'"))"
IF RC > 0 THEN
SAY 'DEFINE CLUSTER FAILED FOR' VDSN
ELSE
DO
"REPRO INDATASET("'VDSN'") OUTDATASET("'ODSN'") REPLACE"
IF RC = 0 THEN
SAY ' VSAM FILE COPY SUCCESSFUL'
END
END

The error is due to the file preceding with my id A123. Toavoid this , I have actually given quotes to the file. Even then , I got the same error.

Please let me know how I can fix this..

Re: Error in rexx code execution

PostPosted: Wed Jan 26, 2011 7:50 pm
by prino
You learn something every day, never knew about the existence of

ADDRESS ISREDIT "(VDSN) = VSAMFILE"
...

Suggest you start reading manuals before you post!

Re: Error in rexx code execution

PostPosted: Wed Jan 26, 2011 9:57 pm
by MrSpock
I was curious why this code is written as a quasi-ISPF Edit Macro (I don't see any actual EDIT Macro commands). Anyway, once you address Robert's comment, it would be nice to see a full runtime TRACE posted.

Re: Error in rexx code execution

PostPosted: Thu Jan 27, 2011 2:49 am
by Pedro
ADDRESS ISREDIT "(VDSN) = VSAMFILE"


Are you a time traveler from the future, where editing a VSAM file is supported?

Re: Error in rexx code execution

PostPosted: Thu Jan 27, 2011 11:06 am
by NicC
Given the fact that TS states "just started learning Rexx" we should cut SOME slack. Looks like s/he is starting off by writing an ISPF edit macro - probably not the best place to start but ... hey!

Next thing is that Rexx does not 'do' VSAM unless you have a nifty bit of assembler code - RXVSAM. However, the copy is being attempted using REPRO. Now, this is an IDCAMS command and I do not know if it can be used stand-alone. If it can, then I have added another bit of knowledge today.

Methinks that this is not the full macro but that it has been hacked down for the posting, otherwise why all the unnecessary DOs and ENDs? Also the error messge identifis A123.VDS as the dataset it is trying to allocate - what happened to the value in ODSN?

Re: Error in rexx code execution

PostPosted: Thu Jan 27, 2011 12:29 pm
by mongan
First, you should have taken a good look at the error messages. You could use the internet function provided by IBM, Lookat.
http://www-1.ibm.com/servers/eserver/zs ... ookat.html

If you would have examined the error messages you would have found out that the data set is not cataloged, and it tells you which one.
A123.VDSN. This is supposed to be a model for your define. You probably missed that you do not have a model A123.VDSN, but you might have a VDSN model. I assume that the problem is that your userid is prefixed to your VDSN. Besides that, I take it that VDSN has not been supplied with a real name for the model. This should get you started in the right direction.