Jonathan Engwall
Jonathan Engwall

Reputation: 59

using REXX to access vm370 disks

REXX is completely new to me, I like it so far. I am using SixPack running on Hercules. VM/370 is a nice environment, but I am trying to make it user friendly; filling in scripts for everything that works-so as to not need to repeat my steps. The file attached below was written to search in ISFP, instead I want it to access disks. It searches for a specified file. I do not know enough to rewrite a REXX program. It stops at strange places saying "found" this or that. Please, give any suggestions.

/* REXX */
ARG PROGNAME
PROGNAME = STRIP(PROGNAME)
ACCESS_TEMPLATE='A2 Y U'
USE VAR ACCESS_TEMPLATE A2 Y U      /* NOT PARSE */
VAR1 = A2
VAR2 = Y
VAR3 = U
IF PROGNAME == '' THEN DO
  SAY 'ENTER MEMBER NAME'
  FULL PROGNAME
  PROGNAME = STRIP(PROGNAME)
  IF PROGNAME == '' THEN DO
    SAY NO MEMBER ENTERED. EXITING THE PROGRAM
    EXIT
  END
END
SEARCH.1 = PROD1.LIB
SEARCH.2 = PROD2.LIB
SEARCH.3 = PROD3.LIB
CNT = 3
FND = 'N'
DO I = 1 TO CNT
  ACCESS 'VAR1' 'VAR2' 'VAR3'
  LIB = LIST.I(PROGNAME)
  IF SYSDSN('LIB') == OK THEN DO
    FND = 'Y'
    TYPE('LIB')
  END
END
IF FND == 'N'THEN DO
  SAY MEMBERS NOT FOUND IN ANY LIBRARIES
  SAY PLEASE CHECK THE MEMBER ENTERED
  EXIT
END

Upvotes: 0

Views: 124

Answers (1)

Robert Schreiber
Robert Schreiber

Reputation: 61

This is a bit late but it's good advice for novice REXX programmers...

Right near the top of your program put in this:

SIGNAL ON NOVALUE

and then near the every end...

NOVALUE: SAY 'NOVALUE error at line' SIGL
         exit 4

Why? REXX has a "feature" in that every undefined variable resolves to its own name in UPPER case, like this:

myvar1='hi there'
mayvar2=', joe'
say myvar1||myvar2

What you probably intended to SAY was 'hi there, joe' but instead got 'hi thereMYVAR2'

If you had SIGNAL ON NOVALUE it would have given you an error message which is a lot better. I ALWAYS put this into my code.

Upvotes: 3

Related Questions