|
|
| Author |
Message |
Pankaj Gupta
New User
Joined: 07 May 2008 Posts: 32 Location: Bangalore
|
|
|
|
Hello,
I am trying to dynamically allocating a file in assembler.
Here is another way:
| Code: |
LINK EP=BPXWDYN,PARAM=(PARM01),VL=1
PARM01 DC CL36'ALLOC FI(DDNAME) DA(MY.FILE.NAME) SHR' |
But how then am I to use DDNAME so that I can be writing to it? |
|
| Back to top |
|
 |
References
|
|
 |
Bill Dennis
Senior Member
Joined: 17 Aug 2007 Posts: 313 Location: Iowa, USA
|
|
|
|
| You include a DCB and do an OPEN on the file. |
|
| Back to top |
|
 |
Pankaj Gupta
New User
Joined: 07 May 2008 Posts: 32 Location: Bangalore
|
|
|
|
It cannot be this simple. If I am doing that then the program simply thinks there shoul dbe a DD statement in the JCLs.
But I am dynamically allocating and so somehow I am needing to link the DD name in the OPEN with what BPXWDYN has been allocating. |
|
| Back to top |
|
 |
Bill Dennis
Senior Member
Joined: 17 Aug 2007 Posts: 313 Location: Iowa, USA
|
|
|
|
| That is exactly what dynamic allocation is about. Allocating a file without JCL, but just as if it were in the JCL. |
|
| Back to top |
|
 |
Bill Dennis
Senior Member
Joined: 17 Aug 2007 Posts: 313 Location: Iowa, USA
|
|
|
|
I see in your other post you are confused on the DDNAME. In your example, change FI(DDNAME) to the ddname you wish to use, ex. FI(CARDIN)
You want to give a ddname, not let one be returned. |
|
| Back to top |
|
 |
Pankaj Gupta
New User
Joined: 07 May 2008 Posts: 32 Location: Bangalore
|
|
|
|
Yes, indeed, I am wanting to give a DD name. DDNAME is being a valid DD name. In fact in my program I am using a DD name other than DDNAME, I just changed it to DDNAME for the purpose of the posting.
the question is still remaining, hjow is the assembler program knowing that my OPEN (DDNAME) is the DDNAME I am providing to the BPXWDYN. The assembler program is naturally expecting DDNAME to being part of a DCB... and then when I am running it is expecting DDNAME to being in the JCLS.
In PL1 I have done this and it is working very perfectly. |
|
| Back to top |
|
 |
Bill Dennis
Senior Member
Joined: 17 Aug 2007 Posts: 313 Location: Iowa, USA
|
|
|
|
I don't know how else to explain this.
1. Do the dynamic allocation using your desired DDname, for ex. FI(CARDIN)
2. Your program includes a DCB macro INREC DCB DDNAME=CARDIN,.....
3. You do an OPEN for the DCB just as if the DD were in the JCL OPEN (INREC,(INPUT)) |
|
| Back to top |
|
 |
Robert Sample
Senior Member
Joined: 06 Jun 2008 Posts: 963 Location: Atlanta, GA
|
|
|
|
| Quote: |
| and then when I am running it is expecting DDNAME to being in the JCLS. |
Why? Where did you get this idea? As long as the DDNAME is defined, whether by BPXWDYN or JCL or SVC 99, the Assembler program doesn't care when it does the OPEN on the DDNAME. |
|
| Back to top |
|
 |
Pankaj Gupta
New User
Joined: 07 May 2008 Posts: 32 Location: Bangalore
|
|
|
|
Bill and Robert,
What you are saying is what I would expect to be happening. But this is not what is happening. When I am running the program it is getting the SOC1 because the DD name is missing from the JCL.
Here is the small program:
| Code: |
ASS09 CSECT
STM R14,R12,12(R13)
BASR R12,R0
USING *,12
ST R13,SAVE+4
LA R13,SAVE
L R13,SAVE+4
LINK EP=BPXWDYN,PARAM=(PARM01),VL=1
OPEN (OUTREC,(OUTPUT))
PUT OUTREC,OUTLINE
CLOSE (OUTREC)
*
LM R14,R12,12(R13)
LA R15,0
BR R14
*
SAVE DS 18F
*
PARMLIST DC A(PARM01)
*
PARM01 DC CL36'ALLOC FI(MYFILE) DA(DVDYC.ASS.FL) SHR'
*
OUTLINE DC CL80'THIS IS AN OUTPUT LINE'
*
OUTREC DCB DSORG=PS,DDNAME=MYFILE,MACRF=PM,
RECFM=FB,LRECL=80,BLKSIZE=27920
*
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
*
END |
and here is this form the abendaid:
| Code: |
SPECIFIC INFORMATION
I/O INSTRUCTION ISSUED AGAINST DDNAME MYFILE
WHICH IS MISSING FROM JCL. |
|
|
| Back to top |
|
 |
Robert Sample
Senior Member
Joined: 06 Jun 2008 Posts: 963 Location: Atlanta, GA
|
|
|
|
Just for curiosity, where in your code are you checking the return code of the BPXWDYN link to ensure that BPXWDYN actually did allocate the DDNAME? If the LINK failed, the OPEN will fail and probably with an S0C1 since the link failing means there's probably no DDNAME defined to OPEN.
And Abend-Aid doesn't know you're doing a dynamic allocation, so it assumes your DDNAME will be in the JCL. It doesn't have to be; if the LINK to BPXWDYN is working, the OPEN will work even without a MYFILE DD statement. |
|
| Back to top |
|
 |
Pankaj Gupta
New User
Joined: 07 May 2008 Posts: 32 Location: Bangalore
|
|
|
|
Yes, that is being a good point re abendaid not knowing about the dynamic allocation.
The documentaiton for BPXWDYN is so poor that I am not sure where is being the return code or I would have checked. Would it perhaps be in R15? |
|
| Back to top |
|
 |
Robert Sample
Senior Member
Joined: 06 Jun 2008 Posts: 963 Location: Atlanta, GA
|
|
|
|
If you look in this ftp://ftp.software.ibm.com/s390/zos/tools/bpxwdyn/bpxwdyn.html you can find
| Quote: |
When called as a program, the return code is available in R15.
BPXWDYN returns the following codes:
0
Success
20
Invalid parameter list. See Calling Conventions for parameter list formats.
-21 to -9999
Key error
-100nn
Message processing error. IEFDB476 returned code nn.
>0
Dynamic allocation or dynamic output error codes |
|
|
| Back to top |
|
 |
Pankaj Gupta
New User
Joined: 07 May 2008 Posts: 32 Location: Bangalore
|
|
|
|
Oh well. R15 is seeming to have 0000FD9A after the call.
I might as well be giving up as there seems not much else I can be doing. |
|
| Back to top |
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 3183 Location: italy
|
|
|
|
if I remember correctly the format of the parameter list to be passed on a link macro id the same You would get at program initiation
something like
| Code: |
L R1,ALCPTR
LINK EP=BPXWDYN
LTR R15,R15
BNZ ALCERR
..... CONTINUE PROCESSING
ALCERR DS 0H
... ERROR PROCESSING
...
...
ALCPTR DC A(ALCLIST)+X'80000000'
ALCLIST DC AL2(80)
ALCPAR DC CL80''ALLOC FI(MYFILE) DA(DVDYC.ASS.FL) SHR'
|
the load could be a load address, in two runs You can find which is the good instruction |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8768 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| It cannot be this simple. |
Actually, it can. . .
| Quote: |
| The documentaiton for BPXWDYN is so poor |
If is not good form to blame the documentation for one's inexperience.
| Quote: |
| I might as well be giving up as there seems not much else I can be doing. |
If you come back to this after you gain considerably more experience, it will not appear so difficult. |
|
| Back to top |
|
 |
|
|