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

Selcopy for Inserting record in IMS/DL1 database


IBM Mainframe Forums -> IMS DB/DC
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
yogeshpawar

New User


Joined: 01 Mar 2006
Posts: 37
Location: Sussex-UK

PostPosted: Tue Mar 10, 2009 4:13 am
Reply with quote

Hi,

I am trying to write a selcopy which will read from INFILE and insert the records in IMS/DL1 database ABC with segment SEGMT123 having record length as 1000. I tried following

Code:
READLOOP                                                                                                   READ INFILE INTO 100                                             
          IF EOF INFILE                                                   
           THEN CHKP 1 DL1                                               
           THEN EOJ                                                       
*                                                                       
NEXTREC                                                                 
        GHN ABC DL1 SEG SEGMT123 INTO 2000                         
*                                                                       
       IF STATUS EQ 'GE'                                               
          THEN ISRT ABC DL1 SEG=SEGMT123 FROM 100  L=1000           
          THEN GOTO READLOOP                                             
       GOTO NEXTREC         


But for some reason I get select time error 576 which means segment greater than worklen but I have defined worklen as 3000. Can you please let me know whether above is correct code or do I need to make any changes in this?
Back to top
View user's profile Send private message
Sandy Zimmer

Active Member


Joined: 13 Jun 2007
Posts: 826
Location: Wilmington, DE

PostPosted: Tue Mar 10, 2009 6:22 pm
Reply with quote

Where is your logic for checking status codes for the insert? Everything you do in IMS needs to be checked. For instance, I would check your read status code for spaces - if spaces get the next input record - if GE - perform the insert logic - otherwise, something is very wrong. Are you fully qualifying your SSA on your GHN? Is you database variable length - if so, you will need to set a length for your insert.
Back to top
View user's profile Send private message
Nick Jones

New User


Joined: 28 Apr 2009
Posts: 13
Location: UK

PostPosted: Wed Apr 29, 2009 4:09 pm
Reply with quote

Hi yogeshpawar,

This may seem a silly question but have you actually specified a worklen ?
Your code section does not start with: OPTION WORKLEN=3000

Alternatively, you could specify worklen=3000 on your prime (1st mentioned) READ statement, although the OPTION statement is clearer.
(e.g. READ INFILE INTO 100 WORKLEN=3000 )

You should also be aware that you need to test POS STATUS not just STATUS. i.e.

Code:
IF POS STATUS  EQ  'GE'


For efficiency, you may also want to test for an end-of-file condition for your database ABC immediately following the GHN statement, i.e.

Code:
IF EOF ABC
  THEN GOTO EOJ            * End of job - no more segments.


IF EOF for a DL/1 data base is equivalent to testing STATUS code "GB".
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 -> IMS DB/DC

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top