* OPEN INTERNAL READER AS OUTPUT FILE
OPENRDR DS 0H
WTO 'OPENING INTERNAL READER'
OPEN (WRKACB,(OUTPUT)),MF=(E,WRKOPEN)
LTR R2,R15
BZ WRITERDR
WTO 'OPEN FAILED'
WRITERDR DS 0H
WTO 'WRITING INTERNAL READER'
LA R3,JCLLINES
WRLOOP DS 0H
WTO MF=(E,(3)) ECHO BEFORE WRITE OUT
LA R2,4 SKIP WTO HEADER
AR R3,R2
CLC 0(1,R3),=C'*' IS THE EOF LINE?
BZ CLOSERDR YES: EXIT LOOP
MVC WRKJCREC,0(R3) NO: WRITE TO OUTPUT REC
LA R2,80 GO TO NEXT LINE
AR R3,R2
PUT RPL=WRKRPL OUTPUT REC TO INTERNAL READER
LTR R2,R15 WORKED?
BZ WRLOOP YES: CONTINUE LOOP
WTO 'PUT FAILED' NO: LOG ERROR MESSAGE
* CLOSE INTERNAL READER
CLOSERDR DS 0H
WTO 'CLOSING INTERNAL READER'
CLOSE WRKACB,MF=(E,WRKCLOSE)
But it is not working:no new job was seen in SDSF and the following error message was found in JESMSGLG:
+//ZHOUTEST JOB 127300030,ZHOCH02,CLASS=A,REGION=0M
+//STEP1 EXEC PGM=IEFBR14
$HASP125 LNGRDR INTRDR SKIPPING FOR JOB CARD FROM JOB18853 LNGRDR
+//STEP2 EXEC PGM=IEFBR14
(See the 3rd line in the log)
The JCL that my programme tried to submit only has 3 lines (for test purpose) as seen in the above log. But the '$HASP125' message said the JCL was rejected.
I tried the following things:
1. Copied the 3 lines of test JCL to a normal dataset and manually 'sub' it, it worked fine.
2. I made my programme's load module dataset authorized.
But nothing worked for me so far. Is there anything I did wrong? or did I omitted anything? For example, do I have to 'sign on' a user in my programme before opening the internal reader? (nobody mentioned this on the internet)
Thank you very much!