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

Lenerror in CICS VSAM


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Thu Jul 26, 2012 3:45 pm
Reply with quote

What DickB pointed out earlier, would solve the problem.
My understanding is that the WS-FLDCNT, in the read record, will tell you the actual occurances of the WS-LAYOUT in the read record.
This value is stored here when the record was written.
When the translator finds the INTO(WS-DMAPKSDS) and no length supplied, is creates the LENGTH(Length if DMAPKSDS), which is dependant on a value in WS-FLDCNT, which is "unknown" at the time of the Read, and will produce an invalid result.
My suggestion is that you simply remove the DEPENDING ON WS-FLDCNT, and the outcome of the Length of... will always be 80.
What will be read is the actual length of the record in the file, and the indicator WS-FLDCNT will tell you the actual number of occurances in this record.
Next time you read, the value might change, but implicit LENGTH will always be 80, which is always sufficient.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jul 26, 2012 7:37 pm
Reply with quote

good heavens, people!

1. stay out of linkage. keep your vsam record structure in working-storage.

2. populate ws-fldcnt with 17 prior to the LENGTH OF of RECOR statement,
then you will have a length of 80 prior to the read.
and you can do this. you are changing nothing in the real record,
since you have not read it yet.
all you are trying to do is generate an 80 from the LENGTH OF statement,
and unless ws-fldcnt contains 17, you will not be able to do so.

3. do not remove the DEPENDING ON portion of the OCCURS clause,
you will no longer have variable length records.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 26, 2012 8:31 pm
Reply with quote

You have two basic choices. Set the ODO to 17. Or just remove the ODO.

The removal of the ODO won't affect the reading of the file, but, as dbz has pointed out, you'd not have a variable-length record any more for a write.

Forget for a moment that it is all impossible, and just try it. Let us know. If you don't try it, I can't see what further help we can offer.

Either will "fix" your problem. Retaining the ODO probably would mean the rest of the program works in relation to the length of the VSAM record without you having to do anything.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jul 26, 2012 8:42 pm
Reply with quote

removing the ODO also means a SEARCH ALL will not function properly.
Back to top
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Thu Jul 26, 2012 9:14 pm
Reply with quote

Neither any Search or Write was part of the initial post!
Binary Search cant ge performed on this "simple" table, as it is not defined for that.
Whats wrong with Linkage Section for a program that reads a file!?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jul 26, 2012 9:31 pm
Reply with quote

Quote:
Whats wrong with Linkage Section for a program that reads a file!?


considering the competence of the poster,
obviously confusing and an unnecessary complication

plus, why use linkage? not a good habit.
it is the same as using the FD for a file record.

though in the case of CICS,
i believe CICS issues a GETMAIN for the structure
and moves the data to the newly acquired storage
and must set a POINTER.
a lot of overhead to save 80 bytes in working-storage.

have to use working-storage for a rewrite if length is changed anyway.

if there is a problem, the dump also has to include the GETMAINed storage
else you don't have the record
whereas if it is in working-storage,
there is a chance that it can be found.

it may be your habit,
but i do not consider it good programming practice.
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: Thu Jul 26, 2012 9:57 pm
Reply with quote

I haven't coded for a while, but I'd like to throw this into the mix as a possibility and DBZ may not like this. icon_wink.gif

Define an 01 area in LINKAGE (length of 256 to be safe), define a WS halfword-length and set it to ZERO.

Issue the READ with a SET(ADDRESS OF 01 LINKAGE AREA) and the actual record-length will be set in the halfword.

Move the 01 LINKAGE area to the 01 WORKING-STORAGE area, using reference modification, based upon the halfword-length.

Then, calculate the ODO based upon the halfword-length.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Jul 26, 2012 11:21 pm
Reply with quote

as a final thought,

Peter,
the only reason we are having this discussion

(and yes,
in CICS modules
I occasionally use linkage and do getmains
but still consider it poor programming practice,
because it takes a competent person to follow me
when I code that way)


is because the TS is a poorly trained, inexperienced COBOL programmer.
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 -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top