z/OS TSO/E CLISTs
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Analyzing input strings with &SUBSTR - the SUBMITFQ CLIST

z/OS TSO/E CLISTs
SA32-0978-00

You can use the &SUBSTR built-in function to analyze input from the invoker and to modify the input if necessary.

The SUBMITFQ CLIST, shown Figure 1, determines whether the data set name supplied by the invoker is a fully-qualified name or not. If the data set name is not fully qualified (does not include a user ID), the SUBMITFQ adds the user ID and submits the data set name in the correct form on a JCL statement.

SUBMITFQ determines whether the data set name is fully qualified by comparing the first character in &DSN to a single quote ('). If the logical comparison is true, the CLIST assumes a fully-qualified data set name and removes the quotation marks. (Unlike on the ALLOCATE command, fully-qualified data set names are not enclosed in singquotation marksle quotes on JCL statements.) If the first character of &DSN is not a single quote, the CLIST assumes the data set name is not fully qualified and prefixes the character string "&SYSUID.." to the value of &DSN. In either case, &DSN contains a fully-qualified data set name when referred to in the SYSUT1 JCL statement.

Figure 1. The SUBMITFQ CLIST
 PROC 2 DSN ACCT CLASS(C)

 /**********************************************************************/
 /* IF &ACCT IS NOT VALID, CONTINUE PROMPTING UNTIL THE USER ENTERS  */
 /* AN ACCEPTABLE VALUE.                                               */
 /**********************************************************************/

 DO WHILE &LENGTH(&STR(&ACCT)) ¬= 4 OR &DATATYPE(&ACCT) ¬= NUM
  WRITE Your account number is invalid.
  WRITE Reenter a four-digit number.
  READ ACCT
 END
 
 /**********************************************************************/
 /* IF THE DATA SET IS FULLY QUALIFIED, REMOVE THE QUOTATION MARKS.  OTHERWISE, */
 /* PREFIX THE CURRENT USERID.                                         */
 /**********************************************************************/

 IF &STR(&SUBSTR(1,&DSN)) = ' THEN + 
  SET DSN = &STR(&SUBSTR(2:&LENGTH(&DSN)-1,&DSN))
 ELSE SET DSN=&STR(&SYSUID.&DSN)
 WRITE &DSN
 
 /**********************************************************************/
 /* ONCE ACCOUNT NUMBER HAS BEEN VERIFIED, SUBMIT THE JOB.             */
 /**********************************************************************/

 SET SLSHASK=&STR(/*) /* Set the /* req. for the jcl comment statement */
 SUBMIT *   END($$)
 //&SYSUID1 JOB   &ACCT,&SYSUID,CLASS=&CLASS
 /&SLSHASK   THIS STEP COPIES THE INPUT DATASET TO SYSOUT=A
 //COPY      EXEC  PGM=COPYDS
 //SYSUT1    DD    DSN=&DSN,DISP=SHR;
 //SYSUT2    DD    SYSOUT=A
 $$

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014