R.S. wrote:
>Both questions regard COBOL
>
>1. JCL EXEC ...,PARM='parameter'
>Can I read data from PARM field in EXEC statement ?
>Any ACCEPT ?
Yes! This example accept a numeric parameter of 2 digits. This example is
used to accept a number 1-12 (month) and give a RC based on input. If no
parameter are supplied or is incorrect the current month is returned.
LINKAGE SECTION.
01 W2-PARAM.
03 W2-PARAM-TEL PIC S9(4) COMP.
03 W2-PARAM-MM PIC 99.
PROCEDURE DIVISION
USING W2-PARAM.
BEGIN.
IF (W2-PARAM-TEL NOT = 2) OR
(W2-PARAM-MM < 0) OR (W2-PARAM-MM > 12)
MOVE FUNCTION CURRENT-DATE(1:8) TO W1-DATUM
MOVE W1-MM TO RETURN-CODE
DISPLAY 'W1-MM : '
W1-MM UPON OUTSYS
ELSE
DISPLAY 'RC FROM CURRENT DATE: '
W2-PARAM-MM UPON OUTSYS
MOVE W2-PARAM-MM TO RETURN-CODE.
STOP RUN.
>2. Dynamic allocation
>Can I use permanent dataset without DDNAME ?
>In other words can I specify dataset name instead of ddname ?
Yes!!!!!! Of COURSE! Look up BPXWDYN.
WORKING-STORAGE SECTION.
01 SUB-PGM PIC X(8) VALUE 'BPXWDYN '.
01 ALLOC-INVOER-CMD.
05 FILLER PIC X(50) VALUE
' ALLOC DD(FILEIN) DSN(COBOL.DYNALLOC) OLD '.
05 FILLER PIC X(50) VALUE
' '.
01 COMMAND-STRING.
05 C-S-LEN PIC S9(4) BINARY VALUE +100.
05 C-S-DATA.
07 FILLER PIC X(100).
MOVE ALLOC-INVOER-CMD TO C-S-DATA.
CALL SUB-PGM USING COMMAND-STRING.
Groete / Greetings
Elardus Engelbrecht
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html