Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
I've gotten BPXWDYN running from Assembler. This program uses standard linking conventions and returns a condition code of zero in the JCL. The code is:
Code:
ASMTEST CSECT
REGEQU
STM R14,R12,12(R13)
LR R12,R15
USING ASMTEST,R12
LA R15,SAVEAREA
ST R13,4(R15)
ST R15,8(R13)
LR R13,R15
OPEN (SYSPRINT,(OUTPUT))
PUT SYSPRINT,=CL133'HELLO WORLD'
LINK EP=BPXWDYN,PARAM=(P1ADDR),VL=1
LTR R15,R15
* TEST FOR GOOD RETURN -- IF SO, JUMP OVER MOVE OF R15 TO OUTPUT
* BZ DYNWRITE
CVD R15,R15CVD
UNPK BPXM1R15(8),R15CVD+4(4)
CLI BPXM1R15+7,C'J'
BL BPXPLUS
MVI BPXMSG1+14,C'-'
B PUTCODE
BPXPLUS EQU *
MVI BPXMSG1+14,C'+'
PUTCODE EQU *
OI BPXM1R15+7,X'F0'
PUT SYSPRINT,BPXMSG1
DYNWRITE EQU *
OPEN (DDN,(OUTPUT))
PUT DDN,BPXMSG2
CLOSE (DDN)
LINK EP=BPXWDYN,PARAM=(P2ADDR),VL=1
CLOSE (SYSPRINT)
L R13,SAVEAREA+4
XR R15,R15
RETURN (14,12),RC=(15)
SAVEAREA DS 18F
DDN DCB DDNAME=MYFILE,BLKSIZE=27920,DSORG=PS,MACRF=(PM), X
LRECL=80
SYSPRINT DCB DDNAME=SYSPRINT,BLKSIZE=133,DSORG=PS,MACRF=(PM)
DC C'SYSSNAP DCB FOUNDATION.'
CNOP 0,4 FULLWORD ALIGNMENT.
P1ADDR DC H'54'
PARM01 DC CL54'ALLOC DD(MYFILE) DA(''TTSSRS0.BPXWDYN.FILE.DATA'') X
SHR'
CNOP 0,4 FULLWORD ALIGNMENT.
P2ADDR DC H'16'
PARM02 DC CL16'FREE DD(MYFILE)'
R15CVD DS D
BPXMSG1 DC 0CL133
BPXMSG2 DC 0CL80
DC CL15'BPXWDYN R15 = '
BPXM1R15 DS CL8
DC CL110' '
FINAL EQU *
END ASMTEST
The JCL that runs this program does not include DDNAME MYFILE but is:
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
To add to what Dick said (I didn't see his post before putting my code up), the use of the LINK assembler macro requires use of certain standard calling conventions, which you chose to ignore (or didn't know about). The program I posted follows the LINK calling conventions and wrote to a DDNAME that was not defined in JCL. 55 lines of Assembler to start up, call BPXWDYN, and exit is not a large program. Getting so frustrated on such a simple task is not a good indicator for future success -- perhaps you need to reconsider an IT career???
Now I am back from my holiday I have revied your fine code Mr Robert and I am seeing that my code was nearly right, missing only the 2 lines. Now my code is working well. Thank you for your help Mr Robert.
Mr Dick, I must say that I am in fact having 20 years of the informations technology experience. In fact, here on my desk they have been putting a sign which is saying "IT Guru", which I think is speaking for itself.
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Quote:
they have been putting a sign which is saying "IT Guru", which I think is speaking for itself.
Opinions vary. . .
Quote:
I must say that I am in fact having 20 years of the informations technology experience
Apparently not with this type of beginning assembler code (standard linkage should be the first discipline learned and understood with assembler - imho). Also, with 2 decades experience, one should surely have learned that "guru"s do not blame the documentation when they do not understand something.
BPXWDYN is designed to be called from REXX, but may also be called by any program. Three parameter list forms are supported.
REXX External Function Parameter List
This parameter list allows REXX programs to call the BPXWDYN programs as a function or subroutine. They must be called with a single string parameter:
if BPXWDYN("alloc dd(sysin) da('my.dataset') shr")<>0 then
call allocfailed
Conventional MVS Variable Length Parameter String
This is the same parameter list as is generated by ADDRESS LINKMVS with one parameter and JCL with EXEC PGM=,PARM=. This parameter list form is simple to use by any program. Note that this is a single item variable length parameter list. The high bit is on in the parameter address word and length is a half word.
Now, I can only conclude that one of three possibilities occurred:
1. You did not read the material you were referred to. "Guru"s read documentation, especially when told it can solve their problem.
2. You read this document but did not comprehend it. Since this is basic, elementary Assembler coding conventions, not comprehending this material is not a good indicator for a "Guru".
3. You read this document, comprehended it, but did not follow the coding conventions. A "Guru" would not ignore coding conventions and then complain about the quality of the documentation. Coding conventions may sound optional but they are not -- you disregard them at the peril of your program. Your program problems were entirely caused by your not following the requirements of the called subroutine.