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

Copying File Contents into a Table


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Apr 18, 2013 12:13 pm
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: 8797
Location: Welsh Wales

PostPosted: Thu Apr 18, 2013 12:16 pm
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Apr 18, 2013 12:52 pm
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Apr 18, 2013 1:05 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Apr 18, 2013 1:13 pm
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Apr 18, 2013 1:29 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top