I use the USS "BPX1RED" on my ASM programm - I want to read out the STDIN. The File Descriptor is set to A(0). The read out works, but I get the Return Code X'71' what means that the "File Descriptor is incorrect". Why and what can I do?
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Quote:
The File Descriptor is set to A(0).
This makes no sense to me. A file descriptor is a 4-byte integer value (DS F in Assembler) that is set when using BPX1OPN on the file, and then passed to the BPX1RED and so forth until you close the file. A(0) is not 4 bytes, nor is it an integer value -- so it cannot, by definition, be a file descriptor.
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
If you're not using BPXYCONS, you need to. Using it, from the manual Unix System Services Programming: Assembler Callable Services Reference, an example of closing STDIN is seen in D.22:
Code:
CALL BPX1CLO, Close a file +
(=A(STDIN_FILENO), Input: File descriptor +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Quote:
It doesn't work.
This is useless to post -- WHAT doesn't work? Does it (whatever didn't work) not work by abending during assembly? abending during execution? generating an error during assembly (and if so, which error)? generating an error during execution (and if so, which error)?
And did you try my recommendation yet (putting =A(...) instead of just A(0) in your call)?
This is useless to post -- WHAT doesn't work? Does it (whatever didn't work) not work by abending during assembly? abending during execution? generating an error during assembly (and if so, which error)? generating an error during execution (and if so, which error)?
And did you try my recommendation yet (putting =A(...) instead of just A(0) in your call)?
Sorry I get an Assembly Error. Because the field isn't definied. Ok if I do this, I get the same result as before I wrote
Yes I definited it! But there no difference between:
Code:
A(0)
or the equal, the do the same
sorry But You are completely wrong
I just run a quick and dirty test to show You the difference between
a(0), =a(0), (0), 0
it is enough to look at the macro expansion
Code:
1 PRINT ON,GEN
2 TEST CSECT
3 TEST AMODE 31
4 TEST RMODE ANY
5 YREGS
7+R0 EQU 0
8+R1 EQU 1
9+R2 EQU 2
10+R3 EQU 3
11+R4 EQU 4
12+R5 EQU 5
13+R6 EQU 6
14+R7 EQU 7
15+R8 EQU 8
16+R9 EQU 9
17+R10 EQU 10
18+R11 EQU 11
19+R12 EQU 12
20+R13 EQU 13
21+R14 EQU 14
22+R15 EQU 15
24 LR R12,R15 ADDRESS THIS CSECT
25 USING TEST,R12 AH .. ADDRESSABILITY
26 CALL SUB1,(A(0),PAR1,PAR2),MF=(E,PLIST)
27+ CNOP 0,4
28+ B *+8 BRANCH AROUND VCON
29+IHB0002B DC V(SUB1) ENTRY POINT ADDRESS
34+ LA 1,PLIST LOAD PARAMETER REG 1
35+ LA 14,A(0) PICKUP PARAMETER
** ASMA044E Undefined symbol - A
** ASMA435I Record 137 in SYS1.MACLIB(IHBOPLTX) on volume:
36+ LA 15,PAR1 PICKUP PARAMETER
37+ LA 0,PAR2 PICKUP PARAMETER
38+ STM 14,0,0(1) STORE INTO PARAM. LIST
39+ L 15,IHB0002B LOAD 15 WITH ENTRY ADR
40+ BALR 14,15 BRANCH TO ENTRY POINT
41 CALL SUB2,(=A(0),PAR1,PAR2),MF=(E,PLIST)
42+ CNOP 0,4
43+ B *+8 BRANCH AROUND VCON
44+IHB0007B DC V(SUB2) ENTRY POINT ADDRESS
49+ LA 1,PLIST LOAD PARAMETER REG 1
50+ LA 14,=A(0) PICKUP PARAMETER
51+ LA 15,PAR1 PICKUP PARAMETER
52+ LA 0,PAR2 PICKUP PARAMETER
53+ STM 14,0,0(1) STORE INTO PARAM. LIST
54+ L 15,IHB0007B LOAD 15 WITH ENTRY ADR
55+ BALR 14,15 BRANCH TO ENTRY POINT
56 CALL SUB3,((0),PAR1,PAR2),MF=(E,PLIST)
57+ CNOP 0,4
58+ B *+8 BRANCH AROUND VCON
59+IHB0012B DC V(SUB3) ENTRY POINT ADDRESS
64+ LA 1,PLIST LOAD PARAMETER REG 1
65+ LR 14,(0) PICK UP PARAMETER
66+ LA 15,PAR1 PICKUP PARAMETER
67+ LA 0,PAR2 PICKUP PARAMETER
68+ STM 14,0,0(1) STORE INTO PARAM. LIST
69+ L 15,IHB0012B LOAD 15 WITH ENTRY ADR
70+ BALR 14,15 BRANCH TO ENTRY POINT
71 CALL SUB4,(0,PAR1,PAR2),MF=(E,PLIST)
72+ CNOP 0,4
73+ B *+8 BRANCH AROUND VCON
74+IHB0017B DC V(SUB4) ENTRY POINT ADDRESS
79+ LA 1,PLIST LOAD PARAMETER REG 1
80+ LA 14,0 PICKUP PARAMETER
81+ LA 15,PAR1 PICKUP PARAMETER
82+ LA 0,PAR2 PICKUP PARAMETER
83+ STM 14,0,0(1) STORE INTO PARAM. LIST
84+ L 15,IHB0017B LOAD 15 WITH ENTRY ADR
85+ BALR 14,15 BRANCH TO ENTRY POINT
86 LTORG
87 =A(0)
88 SAVE DS 9D
89 PLIST DS 9D
90 PAR1 DS F
91 PAR2 DS CL8
92 END
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Quote:
Why and what can I do?
Why? STDIN is not open.
What? Call BPX1OPN on STDIN with the right parameters. Batch jobs must establish a Unix System Services environment, including opening the 3 normal Unix files, in order to avoid problems.