Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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

Active Member


Joined: 07 Feb 2009
Posts: 982
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: 1713
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: 6966
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: 2422
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: 2019
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: 10202
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

Active Member


Joined: 07 Feb 2009
Posts: 982
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 FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us