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

Problem in allocation and writing dataset


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Fri Mar 25, 2011 2:23 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Mar 25, 2011 2:48 pm
Reply with quote

And you do not get any non-zero return codes you would like to tell us about?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Mar 25, 2011 3:14 pm
Reply with quote

Or messages including relevant messages from your trace?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Mar 25, 2011 3:23 pm
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 25, 2011 3:45 pm
Reply with quote

And why dont you initialize INPUT.0 with the count of members not processed. (that would be J)
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Sat Mar 26, 2011 1:08 am
Reply with quote

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
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Mon Mar 28, 2011 3:26 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Mar 28, 2011 3:35 pm
Reply with quote

since the allocation failed no reason to expect that the I/O should succeed !
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Mon Mar 28, 2011 3:36 pm
Reply with quote

"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
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Mon Mar 28, 2011 4:08 pm
Reply with quote

Hello Prino,

Thanks much. I was able to solve the problem.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top