forked from moshix/mvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jcmacro.rexx
49 lines (49 loc) · 1.58 KB
/
jcmacro.rexx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* REXX */
/* ONLY FOR DEBUG
CJNUM = CNTJNUM
ADDRESS ISPEXEC "VPUT (CJNUM) PROFILE"
*/
STMT2="// NOTIFY="USERID()",REGION=28M,CLASS=A"
STMTC="//*** JOB CARD GENERATED AUTOMATICALLY *** "
CNTJNUM = 0
ADDRESS ISPEXEC
"ISREDIT MACRO (PGMRNAME)" /* PGMRNAME: PARAMETER PASSED TO THE MACRO */
"ISREDIT (MBR) = MEMBER"
IF LENGTH(PGMRNAME) < 1 THEN DO /* IF PGMRNAME NOT SPECIFIED */
CALL GET_UNAME /* GET PGMRNAME */
END
ELSE DO
IF LENGTH(PGMRNAME) > 18 THEN ,
PGMRNAME = SUBSTR(PGMRNAME,1,18)
END
"VGET (CJNUM) PROFILE"
CVAR = CJNUM
IF DATATYPE(CVAR) <> "NUM" THEN
DO
CJNUM = CNTJNUM
"VPUT (CJNUM) PROFILE"
END
CJNUM = CJNUM + 1
IF CJNUM > 9 THEN DO
CJNUM = 1
END
STMT1 = "//"USERID()||CJNUM||,
" JOB (MOSHIX),'"||PGMRNAME||"',MSGCLASS=H,"
"VPUT (CJNUM) PROFILE"
"ISREDIT LOCATE .ZFIRST" /* TEST IF THE MEMBER IS EMPTY */
IF RC <> 8 THEN "ISREDIT UP MAX" /* TOP OF THE SCREEN */
'ISREDIT LINE_AFTER 0 =(STMT1)' /*PUT IN THE MBR FIRST JOBCARD PIECE */
'ISREDIT LINE_AFTER 1 =(STMT2)' /*PUT IN THE MBR SECOND JOBCARD PIECE*/
'ISREDIT LINE_AFTER 2 =(STMTC)' /*PUT IN THE MBR JOBCARD COMMENT */
"ISREDIT HI JCL" /* HILITE JCL CONTROL STATEMENT */
EXIT
GET_UNAME:
PSAOLD = STORAGE(D2X(548),4) /* PTR PSA */
ASCBASXB = STORAGE(D2X(C2D(PSAOLD)+108),4) /* PTR ASXB */
ACEEADDR = STORAGE(D2X(C2D(ASCBASXB)+200),4) /* PTR ACEE */
USERID = STORAGE(D2X(C2D(ACEEADDR)+21),8) /* USER NAME */
LOGONGRP = STORAGE(D2X(C2D(ACEEADDR)+30),8) /* LOGON GROUP */
ACEEUNAM = STORAGE(D2X(C2D(ACEEADDR)+100),4) /* PTR USER NAME */
PGMRNAME = STORAGE(D2X(C2D(ACEEUNAM)+1),20) /* PROGRAMMER NAME */
PGMRNAME = STRIP(PGMRNAME)
RETURN