View previous topic :: View next topic
|
Author |
Message |
yogeshpawar
New User
Joined: 01 Mar 2006 Posts: 37 Location: Sussex-UK
|
|
|
|
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 |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
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 |
|
|
Nick Jones
New User
Joined: 28 Apr 2009 Posts: 13 Location: UK
|
|
|
|
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 |
|
|
|