Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Problem in allocation and writing dataset

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Problem in allocation and writing dataset
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: 1067
Location: Oostende, Belgium

PostPosted: Fri Mar 25, 2011 2:48 pm    Post subject:
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: 1922
Location: UK

PostPosted: Fri Mar 25, 2011 3:14 pm    Post subject:
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: 6970
Location: porcelain throne

PostPosted: Fri Mar 25, 2011 3:23 pm    Post subject:
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: 2442
Location: Netherlands, Amstelveen

PostPosted: Fri Mar 25, 2011 3:45 pm    Post subject:
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

Senior Member


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

PostPosted: Sat Mar 26, 2011 1:08 am    Post subject: Reply to: Problem in allocation and writing dataset
Reply with quote

I agree with comments about checking the return codes.

Please read this thread:
http://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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10355
Location: italy

PostPosted: Mon Mar 28, 2011 3:35 pm    Post subject: Reply to: Problem in allocation and writing dataset
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: 1067
Location: Oostende, Belgium

PostPosted: Mon Mar 28, 2011 3:36 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Having a problem FTP'ng to the MF pahiker All Other Mainframe Topics 2 Fri Nov 10, 2017 8:20 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us