View previous topic :: View next topic
|
Author |
Message |
anshul_gugnani
New User
Joined: 02 Nov 2009 Posts: 73 Location: Mumbai
|
|
|
|
Hello,
My requirement is to copy list of members from one PDS to another. The list of members which are not found in FROM PDS are to be written in an output file.
My code is working fine for copying the members but I am not able to allocate the output file and write the members not found in it.
Below is my code -
Code: |
/* REXX */
TRACE ?R
ADDRESS TSO
INPUT_PDS='LIST.FILE'
"ALLOC DA('"INPUT_PDS"') F(INFILE) SHR"
"EXECIO * DISKR INFILE (STEM RECD. FINIS"
"FREE F(INFILE)"
ADDRESS ISPEXEC
'CONTROL ERRORS RETURN'
DSN1 = 'FROM.PDS'
DSN2 = 'TO.PDS'
"LMINIT DATAID(DD1) DATASET('&DSN1') ENQ(SHRW) ORG(PO)"
"LMINIT DATAID(DD2) DATASET('&DSN2') ENQ(SHRW) ORG(PO)"
OPDSN = "'NOT.FOUND.LIST'"
"ALLOC FI(SEQFL) DA("OPDSN") NEW UNIT(SYSDA) DSORG(PS)",
"SPACE(100 200) TRACKS LRECL(80) BLKSIZE(6160) RECFM(F B)"
J = 0
DO I = 1 TO RECD.0
MBR = STRIP(WORD(RECD.I,1))
"LMCOPY FROMID(&DD1) FROMMEM(&MBR)",
"TODATAID(&DD2) TOMEM(&MBR) REPLACE"
IF RC \= 0 THEN
DO
J = J + 1
INPUT.J = MBR
END
END
"EXECIO" J "DISKW SEQFL (STEM INPUT. FINIS"
"FREE FI(SEQFL)"
"LMFREE DATAID(&DD1)"
"LMFREE DATAID(&DD2)" |
I am new to REXX,Can anyone please suggest where am I going wrong.
Thanks. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
And you do not get any non-zero return codes you would like to tell us about? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Or messages including relevant messages from your trace? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
again,
code that never checks the return-code of a service call.
before we even attempt to help this rookie,
he should learn how to write professional code. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
And why dont you initialize INPUT.0 with the count of members not processed. (that would be J) |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
I agree with comments about checking the return codes.
Please read this thread:
ibmmainframes.com/viewtopic.php?t=53827
And:
Code: |
OPDSN = "'NOT.FOUND.LIST'" |
I suspect you cannot use such a name, unless you have a high level qualifier defined for 'NOT'. To use your own prefix, remove the single quotes and use the TSO PROFILE command to set your prefix. |
|
Back to top |
|
|
anshul_gugnani
New User
Joined: 02 Nov 2009 Posts: 73 Location: Mumbai
|
|
|
|
Hello,
I am getting return code 20 for allocation of dataset -
Code: |
17 *-* "ALLOC FI(SEQFL) DA("OPDSN") NEW UNIT(SYSDA) DSORG(PS)",
"SPACE(100 200) TRACKS LRECL(80) BLKSIZE(6160) RECFM(F B)"
>>> "ALLOC FI(SEQFL) DA('BCST.NOT.FOUND') NEW UNIT(SYSDA) DSORG(PS) SP
ACE(100 200) TRACKS LRECL(80) BLKSIZE(6160) RECFM(F B)"
+++ RC(20) +++ |
and return code 20 for writing th file
Code: |
30 *-* "EXECIO" J "DISKW SEQFL (STEM INPUT. FINIS"
>>> "EXECIO 1 DISKW SEQFL (STEM INPUT. FINIS"
+++ RC(20) +++ |
dbzTHEdinosauer wrote
Quote: |
he should learn how to write professional code.
|
I am not HE but SHE..Since I am very new to REXX, I needed help on this. Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
since the allocation failed no reason to expect that the I/O should succeed ! |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
"ALLOC" and "EXECIO" are not ISPEXEC commands.
Yet another reason to avoid "ADDRESS environment" commands, but to use the default environment of TSO and to do use "environment ..." to issue commands. |
|
Back to top |
|
|
anshul_gugnani
New User
Joined: 02 Nov 2009 Posts: 73 Location: Mumbai
|
|
|
|
Hello Prino,
Thanks much. I was able to solve the problem. |
|
Back to top |
|
|
|