IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

BPX1RED Incorrect File Descriptor


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
FloGerman

New User


Joined: 10 Feb 2010
Posts: 7
Location: Germany

PostPosted: Tue Oct 19, 2010 5:08 pm
Reply with quote

Hi,

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?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 19, 2010 5:19 pm
Reply with quote

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.
Back to top
View user's profile Send private message
FloGerman

New User


Joined: 10 Feb 2010
Posts: 7
Location: Germany

PostPosted: Tue Oct 19, 2010 5:49 pm
Reply with quote

Ok that's right, but I don't do any OPEN, because I read the STDIN. What shall I open? Look at this:
en.wikipedia.org/wiki/File_descriptor

There the STDIN is as "0".
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 19, 2010 6:15 pm
Reply with quote

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)       ----------------------------------
so I'd try =A(STDIN_FILENO) instead of A(0).
Back to top
View user's profile Send private message
FloGerman

New User


Joined: 10 Feb 2010
Posts: 7
Location: Germany

PostPosted: Tue Oct 19, 2010 6:50 pm
Reply with quote

But "STDIN_FILENO" is only a equate, which is generated by BPXCONS. And the standart value is 0.

Code:
STDIN_FILENO EQU 0 Standard input value, file descriptor


It doesn't work.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 19, 2010 7:35 pm
Reply with quote

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)?
Back to top
View user's profile Send private message
FloGerman

New User


Joined: 10 Feb 2010
Posts: 7
Location: Germany

PostPosted: Tue Oct 19, 2010 8:06 pm
Reply with quote

Robert Sample wrote:
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)?


Sorry icon_smile.gif I get an Assembly Error. Because the field isn't definied. Ok if I do this, I get the same result as before icon_sad.gif I wrote
Code:
(=A(STDIN_FILENO)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Oct 19, 2010 10:46 pm
Reply with quote

Hello,

Quote:
Because the field isn't definied.
Then it needs to be defined. . . When names/labels are used in code, they typically must be defined in the code.

If you haven't already, suggest you look at all of the info Robert mentioned - not just the bit posted:
Quote:
Using it, from the manual Unix System Services Programming: Assembler Callable Services Reference, an example of closing STDIN is seen in D.22:
Back to top
View user's profile Send private message
FloGerman

New User


Joined: 10 Feb 2010
Posts: 7
Location: Germany

PostPosted: Tue Oct 19, 2010 11:12 pm
Reply with quote

dick scherrer wrote:
Hello,

Quote:
Because the field isn't definied.
Then it needs to be defined. . . When names/labels are used in code, they typically must be defined in the code.

If you haven't already, suggest you look at all of the info Robert mentioned - not just the bit posted:
Quote:
Using it, from the manual Unix System Services Programming: Assembler Callable Services Reference, an example of closing STDIN is seen in D.22:


Yes I definited it! But there no difference between:
Code:

A(0)

or the equal, the do the same icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Oct 20, 2010 12:23 am
Reply with quote

Quote:
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
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Oct 20, 2010 9:23 pm
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top