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
 

 

Copying File Contents into a Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Bharath RajaramSridharan

New User


Joined: 10 Dec 2012
Posts: 20
Location: Australia

PostPosted: Thu Apr 18, 2013 7:15 am    Post subject: Copying File Contents into a Table
Reply with quote

Hi,

I wanted to copy the contents of the file into a table. But each of my ispexec commands returns an RC of -3.Here is my piece of code. Could someone help me to correct the issue.

Code:
/* REXX */
call read_files                                                     
call process_file                                                   
/* FREE FILE DATASET DEFINITIONS*/                                   
address tso "free fi(opcfil)"                                       
exit                                                                 
/*******************************************************************/
read_files:                                                         
/* INPUT FILE ALLOCATION */                                         
address tso "execio * diskr opcfil (stem opcstem. finis"             
return 0                                                             
/*******************************************************************/
process_file:                                                       
/* READ INPUT FILE */                                               
trace i                                                             
address ispexec "libdef isptabl dataset id(USERID.TABLE')"   
address ispexec "tbcreate opctabl names (actjb prdjb) write"         
do i = 1 to opcstem.0                                               
  actjb = substr(opcstem.i,1,34)                                     
  prdjb = substr(opcstem.i,40,34)                                   
  address ispexec "tbadd opctabl order"                             
end                                                                 
address ispexec "tbclose opctabl"                                   
exit                                                                 
return 0
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


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

PostPosted: Thu Apr 18, 2013 12:13 pm    Post subject:
Reply with quote

Quote:

id(USERID.TABLE')


I see an unbalanced single quote.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Apr 18, 2013 12:16 pm    Post subject:
Reply with quote

Where do you allocate the input file ?
Or is this a batch process
If so have you allocated all of the required ISPF libraries in the JCL

As a precaution I usually do a TBCLOSE / TBEREASE before creating a new table

Why do you not use REPLACE when creating the table

No other clues given in the output
Back to top
View user's profile Send private message
Bharath RajaramSridharan

New User


Joined: 10 Dec 2012
Posts: 20
Location: Australia

PostPosted: Thu Apr 18, 2013 12:37 pm    Post subject:
Reply with quote

Hi Peter,

The quote was an mistake while I pasted the code here.

Hi Expat,

I run the EXEC through a batch jcl. This is my jcl. Do you see if I have missed any of the libraries being allocated. Please let me know.

Code:
//OPCSCHDR EXEC PGM=IKJEFT01,PARM='OPCTBDMP'                 
//SYSPROC  DD  DSN=USERID.EXEC,DISP=SHR             
//ISPTABL  DD  DSN=USERID.TABLE,DISP=SHR               
//ISPPLIB  DD DSN=SYS1.SISPPENU,DISP=SHR                     
//ISPMLIB  DD DSN=SYS1.SISPMENU,DISP=SHR                     
//ISPSLIB  DD DSN=SYS1.SISPSENU,DISP=SHR                     
//         DD DSN=SYS1.SISPSLIB,DISP=SHR                     
//ISPTLIB  DD DSN=SYS1.SISPTENU,DISP=SHR                     
//SYSPRINT DD SYSOUT=*                                       
//SYSTSPRT DD SYSOUT=*                                       
//SYSOUT   DD SYSOUT=*                                       
//ISPPROF  DD DSN=,DISP=(NEW,DELETE),UNIT=,                 
//    DCB=(RECFM=FB,LRECL=80,BLKSIZE=3120,DSORG=PO),         
//    SPACE=(3120,(20,5,10))                                 
//ISPCTL0  DD UNIT=,DISP=(NEW,DELETE),                       
//    DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,BUFNO=4,DSORG=PS), 
//    SPACE=(TRK,(10,5))                                     
//ISPCTL1  DD UNIT=,DISP=(NEW,DELETE),                       
//    DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,BUFNO=4,DSORG=PS), 
//    SPACE=(TRK,(10,5))                                     
//ISPCTL2  DD UNIT=,DISP=(NEW,DELETE),                       
//    DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,BUFNO=4,DSORG=PS), 
//    SPACE=(TRK,(10,5))                                     
//ISPWRK0  DD UNIT=,DISP=(NEW,DELETE),                       
//    DCB=(RECFM=FB,LRECL=256,BLKSIZE=2560,BUFNO=4,DSORG=PS),
//    SPACE=(CYL,(5,5))                                     
//ISPWRK1  DD UNIT=,DISP=(NEW,DELETE),                       
//    DCB=(RECFM=FB,LRECL=256,BLKSIZE=2560,BUFNO=4,DSORG=PS),   
//    SPACE=(CYL,(5,5))                                         
//ISPWRK2  DD UNIT=,DISP=(NEW,DELETE),                         
//    DCB=(RECFM=FB,LRECL=256,BLKSIZE=2560,BUFNO=4,DSORG=PS),   
//    SPACE=(CYL,(5,5))                                         
//ISPFILE DD DUMMY                                             
//ISPLOG  DD SYSOUT=*,DCB=(RECFM=VA,LRECL=125,BLKSIZE=129)     
//OPCFIL   DD  DSN=USERID.OPCFIL.INPUT,DISP=SHR
//SYSTSPRT DD  SYSOUT=*                                         
//SYSTSIN  DD  DUMMY                                           


This is the trace of the return code -3

Code:
29 *-*  address ispexec "tbcreate opctabl names (actjb prdjb) write"
   >L>    "tbcreate opctabl names (actjb prdjb) write"             
   +++ RC(-3) +++                                                   
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Apr 18, 2013 12:52 pm    Post subject:
Reply with quote

address ispexec "tbadd opctabl order"

You didnt issue a required TBSORT for the table.
Back to top
View user's profile Send private message
Bharath RajaramSridharan

New User


Joined: 10 Dec 2012
Posts: 20
Location: Australia

PostPosted: Thu Apr 18, 2013 12:58 pm    Post subject:
Reply with quote

Peter,

But the exec is returning a -3 code well above it in the libdef ispexec statement itself. In fact, all the ispexec statements return a -3 code. I checked the manuals but couldn't find the reason for it.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Apr 18, 2013 1:05 pm    Post subject:
Reply with quote

So supply us the whole trace output and eventually also JES output of your job.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Apr 18, 2013 1:13 pm    Post subject: Reply to: Copying File Contents into a Table
Reply with quote

pretty elementary ...
instead of
Code:
//OPCSCHDR EXEC PGM=IKJEFT01,PARM='OPCTBDMP' 

You should have used
Code:
//OPCSCHDR EXEC PGM=IKJEFT01,PARM='ISPSTART CMD(OPCTBDMP)' 
Back to top
View user's profile Send private message
Bharath RajaramSridharan

New User


Joined: 10 Dec 2012
Posts: 20
Location: Australia

PostPosted: Thu Apr 18, 2013 1:17 pm    Post subject: Copying File Contents into a Table
Reply with quote

Thanks Enrico. I wasn't aware of that as it my first exercise writing exec involving tables.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


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

PostPosted: Thu Apr 18, 2013 1:29 pm    Post subject:
Reply with quote

Of course Enrico, one sometimes forgets all about the basics. Nice.
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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