View previous topic :: View next topic |
Author |
Message |
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Wed Oct 10, 2018 8:43 am Post subject: Return code -19 from SORT within Rexx |
|
|
This is really annoying me, and it feels like there should be some simple work-around (or something I'm missing).
I found the following code somewhere on line (can't give any credit since I can't find it again). Basically, the idea is to use SORT to copy a member from Librarian on the assumption it's there. I loop through this code up to 5 times (based on the fact that the "levels" we have here at work mean the code could be ANYWHERE within those 5 levels).
Code: |
dsname = library"("member")"
out.1 = ' SORT FIELDS=COPY'
out.0 = 1
call MSG('OFF')
Address TSO
/* 'FREE FI(SYSOUT SORTIN SORTOUT SYSIN)' */
/* 'alloc fi(sysout) dummy shr reuse' */
"alloc f(sysout) Da("rname".SYSOUT) shr reuse"
"ALLOC F(SYSPRINT) SYSOUT(R) LRECL(121) reuse"
scard = " alloc fi(sortin) da('"dsname"') subsys(lam) shr reuse"
call bpxwdyn(scard)
/* Allocate a file for SYSIN and write the sort card to it */
scard = ' alloc fi(sysin) da(&&t1) reuse'
call bpxwdyn(scard)
'execio 'out.0' diskw sysin (stem out. finis'
/* Call the SORT program using the dynamically built sort card */
'Call *(SORT)'
sort_rc = rc
|
When I run through the code, I get the following splattered onto the screen (one rc -19 for each of the first 4 levels - the code DOES exist in the 5th level)
Quote: |
867 *-* 'Call *(SORT)'
+++ RC(-19) +++
*-* 'Call *(SORT)'
+++ RC(-19) +++
*-* 'Call *(SORT)'
+++ RC(-19) +++
*-* 'Call *(SORT)'
+++ RC(-19) +++
|
Looking at the contents of sysout, I see the following
Quote: |
1ICE751I 2 C5-BASE C6-BASE C7-BASE DA-I49502
0ICE805I 1 JOBNAME: SIMMIC , STEPNAME: IKJACCNT
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE185A 0 AN S013 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT (PH
|
My question is - am I missing some allocation somewhere or can anyone suggest a way of avoiding the
Quote: |
*-* 'Call *(SORT)'
+++ RC(-19) +++
|
being splattered for each failed sort/copy? _________________ Michael |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Wed Oct 10, 2018 11:01 am Post subject: Re: Return code -19 from SORT within Rexx |
|
|
misi01 wrote: | This is really annoying me, and it feels like there should be some simple work-around (or something I'm missing). I found the following code somewhere on line (can't give any credit since I can't find it again). |
Misi01,
We had this discussion earlier as you always seem to choose the longest/hardest route to get/find the information. DFSORT Application Programming Guide is *THE Place to find the information you need.
You would have found this
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/ice2ca_REXX_examples.htm
And now coming to your rexx exec, Here are the problems I see
1. I am not even sure as to why BPXWDYN is called to allocate the SORTIN Dataset.
2. Why are you providing a SUBSYS? are you reading batch pipes?
3. You did NOT allocate SORTOUT dataset.
4. You haven't provided any DCB properties for the SYSIN, given that you got S013 explains that there is something Wrong with DCB properties for one of the file.
Please do not copy stuff from the internet and try to find a needle in the haystack.
Either way I would start with something simple like this. (untested, Allocated the SORTOUT to display and I am only COPYING 1 record"
Code: |
/* Simple REXX CLIST to call DFSORT */
"FREE FI(SYSOUT SORTIN SORTOUT SYSIN)"
"ALLOC FI(SYSOUT) DA(*)"
dsname = library"("member")"
"ALLOC FI(SORTIN) DA('"dsname') REUSE"
"ALLOC FI(SORTOUT) DA(*)"
DSN1 = USERID() || ".SYSIN.CARDS"
"ALLOC FILE(SYSIN) DA('"DSN1"') SPACE(1 1) CY",
"NEW CATALOG RELEASE RECFM(F B) LRECL(80) BLK(27920) DSORG(PS)",
"UNIT(SYSDA) REUS"
LIN.1=' OPTION COPY,STOPAFT=1'
"EXECIO * DISKW SYSIN (STEM LIN. FINIS"
ADDRESS LINKMVS ICEMAN
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Oct 11, 2018 12:36 am Post subject: |
|
|
Okay - here's my cleaned up rexx. Note that IF it's relevant, in the script, diallist.general is a PDS (LRECL 121, recfm FBA for my input and output)
Code: |
/* Rexx */
parse source . . rname .
/* say 'In 'rname ; trace a */
dsname = 'SDST.DIALLISU.LDEV1SRC(KAA021)'
rc = check_exists()
dsname = 'SDST.DIALLISP.CMNB0SRC(KAA021)'
rc = check_exists()
return 0
/********************************************************************/
check_exists:
address TSO
call MSG('OFF')
Address TSO
"alloc f(sysin) da(diallist.general(sysin)) shr reuse"
out.1 = ' SORT FIELDS=COPY'
out.0 = 1
'execio 'out.0' diskw sysin (stem out. finis'
"alloc f(sysout) Da(diallist.general(sysOUT)) shr reuse"
"ALLOC F(SYSPRINT) da(diallist.general(sysprint)) shr reuse"
"alloc f(sortin) da('"dsname"') shr reuse"
"ALLOC F(SORTOUT) DA(diallist.general(texosrc)) shr reuse"
say 'Calling SORT/ICEMAN program'
/* 'Call *(SORT)' */
address LINKMVS ICEMAN
say 'RC from sort/ICEMAN 'rc
return 0
|
and here are my results. Using the *(SORT) option first time, I got
Quote: |
KQA020 - doesn't exist in either "PDS"
RC from sort 16 <------- note the "normal" rc=16 - can't find the source
49 *-* 'Call *(SORT)' <----- second attempt, different "PDS"
+++ RC(-19) +++
RC from sort -19
The following text was written to the SYSOUT PDS member
1ICE751I 2 C5-BASE C6-BASE C7-BASE DA-I49502
0ICE805I 1 JOBNAME: SIMMIC , STEPNAME: IKJACCNT
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE185A 0 AN S013 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EX
|
Different member
Quote: |
KAA020 - exists in second PDS
RC from sort 16 <----- both give "expected normal" return codes
RC from sort 0
|
Final attempt using ICEMAN
Quote: |
KAA021 dummy entry - has NEVER existed
RC from sort 16
49 *-* 'Call *(SORT)'
+++ RC(-19) +++
RC from sort -19
Calling SORT/ICEMAN program
RC from sort/ICEMAN 16
Calling SORT/ICEMAN program
System abend code 013, reason code 00000024.
Abend in host command ICEMAN or address environment routine LINKMVS.
31 *-* address LINKMVS ICEMAN
+++ RC(-19) +++
RC from sort/ICEMAN -19
|
I also tried changing the SORTOUT to a sequential FB/80 file in case there was some sort of access conflict, but that made no difference.
Summa summarum. For some reason, the second (failed) attempt at copying a non-existent file fails with RC -19 and splatters all sorts of unwanted text onto the screen. _________________ Michael |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Oct 11, 2018 10:16 am Post subject: |
|
|
misi01 wrote: | Summa summarum. For some reason, the second (failed) attempt at copying a non-existent file fails with RC -19 and splatters all sorts of unwanted text onto the screen. |
Misi01,
You are asking the access method to open a dataset that it has no clue about (non- existent dataset does not have the DCB properties) and it is the access method that fails to open it
Try running the same using the JCL and you will get a much more detail abend details in the JESMSGLG where you will find the IEC/IEF messages which tells you in detail about the problem
DFSORT is only reporting back what the access method has returned with return code of 16. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Fri Oct 12, 2018 2:22 am Post subject: |
|
|
I have no problem with the rc of 16, that's fine.
What I am having a problem with is the fact that as soon as an RC of 16 is returned, subsequent sort calls return a -19 and splatter the results onto the screen (and MSG off and OUTTRAP don't seem to help capture the "splatter")
In fact, I just tested the code again. Fortunately, there are DB2 tables that "tell" me at which of the 5 levels the code can be found. As long as I access the relevant level WITHOUT trying to access the "lower" levels and I dynamically allocate the SORTIN DD-name as
Code: |
scard = " alloc fi(sortin) da('"dsname"') subsys(lam) shr reuse"
call bpxwdyn(scard)
|
then the call to SORT works fine. _________________ Michael |
|
Back to top |
|
|
expat Intermediate
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Mon Oct 15, 2018 4:33 am Post subject: |
|
|
I don't suppose that you had considered using the CA Librarian utility for copying a CA Librarian member.
It seems that you do like to reinvent the wheel _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sat Oct 20, 2018 2:14 am Post subject: |
|
|
I appended what I consider a valid solution in the topic
Quote: | Use Rexx to copy a member from CA librarian to a PDS/file |
Until I found that solution, by googling, the only one I found was the SORT variation, so that's what I went with.
Sometimes, if you don't know better, you go with the tools that SEEM available. _________________ Michael |
|
Back to top |
|
|
|
|