I need to directly execute a USS programme in an MVS programme written in assembler. The MVS programme is executed by a batch job.
I cannot submit another job to execute the USS programme and the executing programme (the MVS programme) must be written in assembler. Rexx or other languages are not options for me.
After spending a lot of time searching the IBM knowledge centre, I figured that the system callable service BPX1SPN (or BPX4SPN) seems to me best bet.
However, I got a problem when doing an experiment:
Since the real USS programme is not ready yet, I wrote a hello world LE C programme which creates a text file in my home directory and writes something in it. I wanted to use the message file to confirm that the USS programme was correctly executed.
The problem (symptom) is that: BPX1SPN returned successful code (RC=0) and also gave me the USS process ID for the execution of the programme. But the message file wasn't created at all. Do you have any experience working with BPX1SPN? Did you have similar problem when using it? Or, any ideas? suggestions? Thanks!
Sorry for the nagging. Just trying to explain it clearly.
Problem with using BPX1SPN
-
- Posts: 40
- Joined: Wed Nov 01, 2017 8:59 pm
- Skillset: XL/C, ISPF, USS
- Referer: My colleagues
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: Problem with using BPX1SPN
Did you use absolute path reference in BPX1SPN or relative path? Did you use absolute or relative path reference in your LE C program? Does your site use FORKCOPY(COW) OR FORKCOPY(COPY) in your SYS1.PARMLIB? It is not unusual for the user id of a batch job to not be the TSO user id you used, so the message file may not have been created due to permissions or it may have been created in the wrong directory.Since the real USS programme is not ready yet, I wrote a hello world LE C programme which creates a text file in my home directory and writes something in it. I wanted to use the message file to confirm that the USS programme was correctly executed.
The problem (symptom) is that: BPX1SPN returned successful code (RC=0) and also gave me the USS process ID for the execution of the programme. But the message file wasn't created at all. Do you have any experience working with BPX1SPN? Did you have similar problem when using it? Or, any ideas? suggestions? Thanks!
-
- Posts: 40
- Joined: Wed Nov 01, 2017 8:59 pm
- Skillset: XL/C, ISPF, USS
- Referer: My colleagues
Re: Problem with using BPX1SPN
Hi Robert, I didn't find the FORKCOPY parameter in the SYS1.PARMLIB (I did srchfor).
I'm using absolute path and I also tried my home directory and the /tmp.
In terms of permission, I tried to execute the USS programme using BPXBATCH in a batch job, it can create the message file in that case.
Anyway, thank you for your suggestions.
I'm using absolute path and I also tried my home directory and the /tmp.
In terms of permission, I tried to execute the USS programme using BPXBATCH in a batch job, it can create the message file in that case.
Anyway, thank you for your suggestions.
-
- Posts: 40
- Joined: Wed Nov 01, 2017 8:59 pm
- Skillset: XL/C, ISPF, USS
- Referer: My colleagues
Re: Problem with using BPX1SPN
This is the final update for this thread. I finally made it work, and I'd like to brief what I did in case it would help someone in the future.
I am using the USS callable service, BPX1SPN, to invoke a mock shell script in the USS file system. In the script, I run a hello-world LE C program which creates a plain text file and sleeps for 60 seconds as well.
The problem that made me create this post was that, although the BPX1SPN gave me RC=0, RSN=0, and a looks-good process ID, the plain text file wasn't created and the sleep(60) didn't happen at all. In other words, the BPX1SPN told me everything was fine, but the commands in the mock shell script weren't executed at all. That was strange.
After a long time of trying, googling and asking, I made it work almost by chance ---
I added " #!/bin/sh " in the shell script and after that things started to work. The plain text file was created and the 1-minute delay happened.
Although it is not explained in the document why the " #!/bin/sh " is required, and so, neither do I know what actually happened under the table, anyway, I can make the following conclusion:
" #!/bin/sh " is required in the shell script if the script is executed by BPX1SPN.
I am using the USS callable service, BPX1SPN, to invoke a mock shell script in the USS file system. In the script, I run a hello-world LE C program which creates a plain text file and sleeps for 60 seconds as well.
The problem that made me create this post was that, although the BPX1SPN gave me RC=0, RSN=0, and a looks-good process ID, the plain text file wasn't created and the sleep(60) didn't happen at all. In other words, the BPX1SPN told me everything was fine, but the commands in the mock shell script weren't executed at all. That was strange.
After a long time of trying, googling and asking, I made it work almost by chance ---
I added " #!/bin/sh " in the shell script and after that things started to work. The plain text file was created and the 1-minute delay happened.
Although it is not explained in the document why the " #!/bin/sh " is required, and so, neither do I know what actually happened under the table, anyway, I can make the following conclusion:
" #!/bin/sh " is required in the shell script if the script is executed by BPX1SPN.
-
- Global moderator
- Posts: 3006
- Joined: Fri Apr 18, 2008 11:25 pm
- Skillset: tso,rexx,assembler,pl/i,storage,mvs,os/390,z/os,
- Referer: www.ibmmainframes.com
Re: Problem with using BPX1SPN
" #!/bin/sh " is required in the shell script if the script is executed by BPX1SPN.
NO...
the shebang line is REQUIRED if You want to execute any script simply typing its name in the <terminal> window
it tells to the session controlling SHELL what executable to invoke to interpret the script
with the shebang line You simply enter
yourscriptname
without it You must know the language of the script and enter the appropriate script processor name
sh/bash/zsh/csh/python/python2/python3/perl/rexx yourscriptname
it would be wise to review Your understanding of the Unix-like systems behaviour when using an explicit or canned shell environment
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
-
- Similar Topics
- Replies
- Views
- Last post
-
- 0
- 5084
-
by mehi1353
View the latest post
Wed May 11, 2022 2:04 pm
-
-
File def'n-problem with different records layouts
by ralph » Tue Oct 26, 2021 10:47 pm » in IBM Cobol - 2
- 1513
-
by ralph
View the latest post
Wed Oct 27, 2021 1:42 am
-
-
-
Got problem using BPX1PCT to define aggregate
by chong_zhou » Thu Aug 19, 2021 4:45 pm » in Assembler - 1
- 1718
-
by chong_zhou
View the latest post
Thu Aug 19, 2021 6:48 pm
-
-
-
Problem in ISPF editor with automatic line break
by aprilgas » Tue Sep 24, 2024 3:24 pm » in TSO & ISPF - 8
- 3391
-
by aprilgas
View the latest post
Fri Sep 27, 2024 3:55 pm
-