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

How to write a low-value record in KSDS using COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Mon Feb 09, 2009 9:04 pm
Reply with quote

How we should write a low value record in KSDS using COBOL. In same program we are reading and deleting records from the respective KSDS file.

Please Help.

Thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Feb 09, 2009 9:12 pm
Reply with quote

MOVE LOW-VALUES to FD 01 and write the record ... is there a particular problem you're having?
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Mon Feb 09, 2009 9:14 pm
Reply with quote

I am getting a logical error IGZ0003W. Thanks Robert for quick reply.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon Feb 09, 2009 9:21 pm
Reply with quote

rohitvw wrote:
I am getting a logical error IGZ0003W. Thanks Robert for quick reply.
What is the associated code?
Please post it........
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Feb 09, 2009 9:23 pm
Reply with quote

From the MAC:
Quote:
IGZ0003W
A logic error occurred for file file-name in program program-name at relative location relative-location.
Explanation:

This error is usually caused by an I/O operation request that is not valid for the fileā€”for example, a WRITE into a file opened for INPUT, or a START to a VSAM ESDS.

A file status clause was specified or an error declarative statement was active for the file.
Programmer response:

Check the operation request and modify the program.
System action:

No system action was taken.
Symbolic Feedback Code:

IGZ003
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Feb 09, 2009 9:25 pm
Reply with quote

Quote:

I am getting a logical error IGZ0003W


no, that is a logic error. your program sucks.
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Mon Feb 09, 2009 9:34 pm
Reply with quote

File Defination
SELECT OPTIONAL CLFILE ASSIGN TO FM27I02
ORGANIZATION IS INDEXED
RECORD KEY IS FILE-KEY-CL
FILE STATUS IS WB-CL-STATUS.
------------------------------------------------------------------
FD DECLARATION
FD CLFILE.

01 CL-RECORD.
COPY CLRECORD.
-------------------------------------------------------------------
I AM WRITING RECORD IN BELOW FASHION

MOVE LOW-VALUES TO CL-RECORD
WRITE CL-RECORD

BUT WRITE STATEMTMENT IS FAILING WITH IGZ0003W ERROR

PLEASE HELP.

THNAKS.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Feb 09, 2009 9:38 pm
Reply with quote

Question 1: What does the OPEN look like -- since the error message I posted is pretty clear in saying the OPEN could be wrong.
Question 2: What is the file status code value? This can provide valuable data about the error.
Question 3: Since the file is optional, are you even sure it is in the JCL? If not, that could also explain why you're getting an error.
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Mon Feb 09, 2009 9:46 pm
Reply with quote

Open Look like
OPEN I-O CLFILE.

Dump is not showing the File status but showing the below error message
IGZ0003W A logic error occurred for file FM27IO02 in program FM27 at relative location X'0FAC'.

File is defined in JCL as below
//FM27I01 DD DSN=CLFILE,DISP=SHR,
// AMP=('ACCBIAS=SYSTEM')

Please Suggest. Thanks.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Feb 09, 2009 9:54 pm
Reply with quote

SELECT OPTIONAL CLFILE ASSIGN TO FM27I02

IGZ0003W A logic error occurred for file FM27IO02 in program FM27 at relative location X'0FAC'.

//FM27I01 DD ...

could the discrepancy in the bolded DD names be the problem?
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Mon Feb 09, 2009 10:00 pm
Reply with quote

No Actually I am just trying rerun the program by changing the file.

By mistake I gave the Dump for the run when file name is FM27I02 in both Cobol program and JCL.

So file is FM27I02 and correct error message is below
IGZ0003W A logic error occurred for file FM27I02 in program FM27 at relative location X'0FAC'.

Sorry for inconvience.

Thanks.

Plese Suggest.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Feb 09, 2009 10:10 pm
Reply with quote

What is the file status code on the open -- put a display in to show it and let us know.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Feb 09, 2009 10:17 pm
Reply with quote

Look at using and testing the FILE STATUS clause, data-name-8 after every OPEN/CLOSE/READ/WRITE.....
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Feb 09, 2009 10:47 pm
Reply with quote

rohitvw wrote:
Open Look like
OPEN I-O CLFILE.


If the file is EMPTY (there aren't any friggin records), then you must OPEN the file for OUTPUT, WRITE a single LOW-VALUES record, CLOSE the file and you're done.

Give this a try....
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Tue Feb 10, 2009 2:00 pm
Reply with quote

Hi all.

Thanks for your replys.

Actually the file is not empty, it is having nearly 3000 records.

File status is not mentioned any ware in spool.

Please suggest.
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Tue Feb 10, 2009 2:13 pm
Reply with quote

FIle Status is 10 when I am trying to write the file
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Tue Feb 10, 2009 2:42 pm
Reply with quote

Is file status is 00 also than also same logical error(IGZ0003W) is coming
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 10, 2009 6:00 pm
Reply with quote

1. File status is captured by the program. YOU must display it or otherwise have it show up on some output. It will not magically appear in the spool.
2. If you don't check the file status on the open, change your program to do so. Now. Before you do anything else. And display the file status if not 00 or 97.
3. File status 10 occurs only on READ as it means you've hit the end of file. I vaguely remember seeing a 10 on a WRITE but only if the OPEN failed in some way -- see #1 above.
4. File status 10 with IGZ0003W would make sense if you're trying to read a file before writing to it.
5. You're not providing adequate data for debugging, forcing us to guess without adequate information. Cut and paste using BBCode the job output when you run it -- expanded JCL and messages from the system log. When you paste as a message the way you did your COBOL code, you leave stuff out that is critical (such as the actual OPEN statement you have for the file).
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Tue Feb 10, 2009 7:06 pm
Reply with quote

Hi Robert.

Thanks for you time and suggestions.

Actually program I need to code is a purge program, and after deleting all the necessary records I have to insert a Low value record if low value record is not available.

I have the file status check in program.

So after putting display for file status, i could see that file status is 10 as program already went through the complete file to delete neccesary records when I am trying write the file.

So I tried to write the file in begining of the program also when file status 00 but still it is giving the same error message IGZ0003W.

Could please let me know how to use BBCode and what exactly BBCode is.

Thanks.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Feb 10, 2009 7:15 pm
Reply with quote

ibmmainframes.com/faq.php?mode=bbcode
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 10, 2009 8:10 pm
Reply with quote

Assuming your code is as you posted, the default is ACCESS IS SEQUENTIAL. This requires records be processed in key sequence. You cannot insert a LOW-VALUES record after processing the deletes since the LOW-VALUES record will not be in sequence. This will cause a logic error exactly as you've seen. You must close the file, open it again, and then you should be able to write the LOW-VALUES record. However, considering the significant gaps in the data you've presented us, there's no guarantee that this will work since you may have not mentioned some other critical factor.
Back to top
View user's profile Send private message
rohitvw

New User


Joined: 04 Feb 2009
Posts: 12
Location: Chennai

PostPosted: Tue Feb 10, 2009 9:37 pm
Reply with quote

Hi Robert.

The problem is with access mode only, it should be dynamic to write a record when few records are already present in KSDS file.

Thanks for your help and efforts, I really appreciate that.

I first time used this forum, I am finally very happy as my code is working as required.

Thank you very much.

Regards
Rohit.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 10, 2009 9:47 pm
Reply with quote

Glad to hear you got it working!
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top