View previous topic :: View next topic
|
Author |
Message |
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Hi,
I have created the VSAM with variable record length as RECORDSIZE(16,80). File created successfully and copied the attached record in VSAM using REPRO.
In my program , i have tried to read the VSAM using below statement
Code: |
EXEC CICS READ
FILE('VSAM1')
INTO (RECOR)
RIDFLD(WS-MSG-KEY)
END-EXEC |
Code: |
WORKING STORAGE SECTION.
01 RECOR.
05 WS-MSG-KEY PIC X(10).
05 WS-FLDCNT PIC 9(02).
05 WS-LAYOUT OCCURS 1 TO 17 TIMES DEPENDING ON WS-FLDCNT.
10 WS-FLDID PIC X(02).
10 WS-FLDLEN PIC 9(02). |
Code'd
While reading , i am getting lengtherror.
I need to complete this very soon. Please help me to solve this issue. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Did you look up what a length error means? From the CICS Application Programming Refernce manual:
Quote: |
LENGERR
RESP2 values:
10
Neither the LENGTH option nor the SET option is specified on a READ command for a file with variable-length records or for a BDAM file with variable-length or undefined-format records.
11
The length of a record read with the INTO option specified exceeds the value specified in the LENGTH option; the record is truncated, and the data area supplied in the LENGTH option is set to the actual length of the record.
13
An incorrect length is specified for a file with fixed-length records.
Default action: terminate the task abnormally. |
It sure likes the first condition applies -- you didn't specify LENGTH, you didn't specify SET and your program is attempting to read a variable-length VSAM file.
In other words, the system did exactly what the manual said it would do, and this is another PEBKAC problem. |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Hi ,
I have added the LENGTH parameter with data area which is length of INTO data area. Still i am facing , same error. The RESP is 22 and RESP2 as 11.
TRANSACTION: PAR1 PROGRAM: CBLFMTCV TASK: 0006330 APPLID: CICSM DISPLAY: 00
STATUS: COMMAND EXECUTION COMPLETE
EXEC CICS READ
FILE ('MQXMLF1 ')
INTO ('CUSTER_RSP11FS20OC03OF20OF10OF10OF20OF10OF03OF10FS10FS10')
LENGTH (80)
RIDFLD ('CUSTER_RSP')
EQUAL
OFFSET:X'000962' LINE:00104 EIBFN=X'0602'
RESPONSE: LENGERR EIBRESP=22
ENTER: CONTINUE
1000-DMAPKSDS-READ.
***********************************************************
EXEC CICS READ
FILE('MQXMLF1')
INTO(WS-DMAPKSDS)
LENGTH(WS-VSAM-LEN)
RIDFLD(WS-MSG-KEY)
END-EXEC
MOVE WS-DMAPKSDS TO WS-MESSAGE
PERFORM DISPLAY-MESSAGE
.
EXEC CICS HANDLE CONDITION
LENGERR(ERROR-HANDLE)
END-EXEC
MOVE WS-PARM-MSGID TO WS-MSG-KEY
MOVE LENGTH OF WS-DMAPKSDS TO WS-VSAM-LEN |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
please provide a listcat of the vsam file.
also, are you populating WS-VSAM-LEN before or after the read? |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Hi,
The Vsam len is populated before the READ statment and find the LISTCAT below
Code: |
LISTCAT ENTRIES(MQXML.POC.DMAPKSDS) ALL
0CLUSTER ------- MQXML.POC.DMAPKSDS
IN-CAT --- CATALOG.MASTER.VZ17CAT
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2012.206
RELEASE----------------2 EXPIRATION------0000.000
SMSDATA
STORAGECLASS -----PERMSC MANAGEMENTCLASS---(NULL)
DATACLASS --------(NULL) LBACKUP ---0000.000.0000
BWO STATUS------00000000 BWO TIMESTAMP---00000 00:00:00.0
BWO---------------(NULL)
RLSDATA
LOG ----------------(NULL) RECOVERY REQUIRED --(NO) FRLOG ------------(NULL)
VSAM QUIESCED -------(NO) RLS IN USE ---------(NO)
0 LOGSTREAMID-----------------------------(NULL)
RECOVERY TIMESTAMP LOCAL-----X'0000000000000000'
RECOVERY TIMESTAMP GMT-------X'0000000000000000'
PROTECTION-PSWD-----(NULL) RACF----------------(NO)
ASSOCIATIONS
DATA-----MQXML.POC.DMAPKSDS.DAT
INDEX----MQXML.POC.DMAPKSDS.IDX
0 DATA ------- MQXML.POC.DMAPKSDS.DAT
IN-CAT --- CATALOG.MASTER.VZ17CAT
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2012.206
RELEASE----------------2 EXPIRATION------0000.000
ACCOUNT-INFO-----------------------------------(NULL)
PROTECTION-PSWD-----(NULL) RACF----------------(NO)
ASSOCIATIONS
CLUSTER--MQXML.POC.DMAPKSDS
ATTRIBUTES
KEYLEN----------------10 AVGLRECL--------------16 BUFSPACE-----------17408 CISIZE--------------8192
RKP--------------------0 MAXLRECL--------------80 EXCPEXIT----------(NULL) CI/CA-----------------90
SHROPTNS(1,3) RECOVERY UNIQUE NOERASE INDEXED NOWRITECHK NOIMBED NOREPLICAT
UNORDERED REUSE NONSPANNED
STATISTICS
REC-TOTAL--------------2 SPLITS-CI--------------0 EXCPS------------------9
REC-DELETED------------0 SPLITS-CA--------------0 EXTENTS----------------1
REC-INSERTED-----------0 FREESPACE-%CI---------10 SYSTEM-TIMESTAMP:
REC-UPDATED------------0 FREESPACE-%CA---------15 X'C9EB0B19368F88C4'
REC-RETRIEVED---------16 FREESPC----------2203648
ALLOCATION
SPACE-TYPE------CYLINDER HI-A-RBA---------2211840
SPACE-PRI--------------3 HI-U-RBA----------737280
SPACE-SEC--------------1
VOLUME
VOLSER------------CMTAS1 PHYREC-SIZE---------8192 HI-A-RBA---------2211840 EXTENT-NUMBER----------1
1IDCAMS SYSTEM SERVICES TIME: 10:46:55 07/25/12 PAGE 2
0 DEVTYPE------X'3010200F' PHYRECS/TRK------------6 HI-U-RBA----------737280 EXTENT-TYPE--------X'00'
VOLFLAG------------PRIME TRACKS/CA-------------15
EXTENTS:
LOW-CCHH-----X'04760000' LOW-RBA----------------0 TRACKS----------------45
HIGH-CCHH----X'0478000E' HIGH-RBA---------2211839
0 INDEX ------ MQXML.POC.DMAPKSDS.IDX
IN-CAT --- CATALOG.MASTER.VZ17CAT
HISTORY
DATASET-OWNER-----(NULL) CREATION--------2012.206
RELEASE----------------2 EXPIRATION------0000.000
PROTECTION-PSWD-----(NULL) RACF----------------(NO)
ASSOCIATIONS
CLUSTER--MQXML.POC.DMAPKSDS
ATTRIBUTES
KEYLEN----------------10 AVGLRECL---------------0 BUFSPACE---------------0 CISIZE--------------1024
RKP--------------------0 MAXLRECL------------1017 EXCPEXIT----------(NULL) CI/CA-----------------33
SHROPTNS(1,3) RECOVERY UNIQUE NOERASE NOWRITECHK NOIMBED NOREPLICAT UNORDERED
REUSE
STATISTICS
REC-TOTAL--------------1 SPLITS-CI--------------0 EXCPS------------------9 INDEX:
REC-DELETED------------0 SPLITS-CA--------------0 EXTENTS----------------1 LEVELS-----------------1
REC-INSERTED-----------0 FREESPACE-%CI----------0 SYSTEM-TIMESTAMP: ENTRIES/SECT-----------9
REC-UPDATED------------0 FREESPACE-%CA----------0 X'C9EB0B19368F88C4' SEQ-SET-RBA------------0
REC-RETRIEVED----------0 FREESPC------------32768 HI-LEVEL-RBA-----------0
ALLOCATION
SPACE-TYPE---------TRACK HI-A-RBA-----------33792
SPACE-PRI--------------1 HI-U-RBA------------1024
SPACE-SEC--------------1
VOLUME
VOLSER------------CMTAS1 PHYREC-SIZE---------1024 HI-A-RBA-----------33792 EXTENT-NUMBER----------1
DEVTYPE------X'3010200F' PHYRECS/TRK-----------33 HI-U-RBA------------1024 EXTENT-TYPE--------X'00'
VOLFLAG------------PRIME TRACKS/CA--------------1
EXTENTS:
LOW-CCHH-----X'0010000A' LOW-RBA----------------0 TRACKS-----------------1
HIGH-CCHH----X'0010000A' HIGH-RBA-----------33791
1IDCAMS SYSTEM SERVICES TIME: 10:46:55 07/25/12 PAGE 3
0 THE NUMBER OF ENTRIES PROCESSED WAS:
AIX -------------------0
ALIAS -----------------0
CLUSTER ---------------1
DATA ------------------1
GDG -------------------0
INDEX -----------------1
NONVSAM ---------------0
PAGESPACE -------------0
PATH ------------------0
SPACE -----------------0
USERCATALOG -----------0
TAPELIBRARY -----------0
TAPEVOLUME ------------0
TOTAL -----------------3
0 THE NUMBER OF PROTECTED ENTRIES SUPPRESSED WAS 0
0IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
0
0IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0
|
Code'd |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
If you run EDF you will see the value of WS-VSAM-LEN after your Read.
This is the (minimum) value CICS wants you to have in the variable before the read. |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
While doing CEDF , WS-VSAM-LEN is 80 after read statment. I have shown above. I have tried wiht average value (what i gave in RECORDSIZE(16,80)) in LENGTH parameter. For this also , i am getting the same error.
Do i need to give 4 bytes for VB VSAM file. IF so, Where, how i have to add this 4 bytes.? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you need to populate the odo object with 17 before you populate ws-vsam-len
with length of function. |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
I am beginner in VSAM. Can you please tell me what is ODO object. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
ODO is Cobol, not VSAM. We use it as an abbreviation for "Occurs Depending On".
It is being suggested that you set the value of the Occurs Depending On to 17 "before you populate ws-vsam-len with length of function." |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
That is not possible...i can set the value from VSAM record which is being read. please guide me - do i need to add 4 bytes for VB VSAM file. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What is not possible?
No, you do not need four bytes... |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
The WS-FLDCNT has a value in the read record, which tells you how many occurances of the WS-LAYOUT there are in the record.
Cobol reserves the maximum length of the WS-LAYOUT, which is 17 occurances, as you know that will be the maximum. This is perfect.
Mentioned also in this post is the SET option.
Why dont you change the read to the following for test purposes:
Code: |
EXEC CICS READ
FILE('VSAM1')
SET(Address of RECOR)
RIDFLD(WS-MSG-KEY)
END-EXEC |
Put the 01 RECOR in Linkage Section. You dont have to supply the LENGTH.
One other strange thing is that you keep the searched key in the RECOR-structure.
This normally is a separate data item outside of the record-structure , and must be when using the SET-option. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I could not fix your brakes so I made your horn louder
Thamilselvi,
has nothing to do with VSAM or CICS.
This is pure COBOL.
The LENGTH OF function for a structure which contains an ODO clause,
will return the length based on the size of the table.
The size of the table depends on the value of the ODO object
Code: |
OCCURS DEPENDING ON WS-CNT |
for further clarification WS-CNT is the ODO object in the above line of code.
why can you not MOVE 17 TO WS-FLDCNT
prior to the LENGTH OF statement
prior to the read?????????? |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
It would be nice if you show us how the WS-VSAM-LEN is declared and how it it given a value and what value EDF shows for this variable BEFORE execution. |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Hi,
Please find the screen shots here...
[/img]
Code: |
TRANSACTION: PAR1 PROGRAM: CBLFMTCV TASK: 0006742 APPLID: CICSM DISPLAY: 00
STATUS: ABOUT TO EXECUTE COMMAND
EXEC CICS READ
FILE ('MQXMLF1 ')
INTO ('CUSTER_RSP11FS20OC03OF20OF10OF10OF20OF10OF03OF10FS10FS10')
LENGTH (56)
RIDFLD ('CUSTER_RSP')
EQUAL
OFFSET:X'000936' LINE:00105 EIBFN=X'0602'
ENTER: CONTINUE |
Code: |
TRANSACTION: PAR1 PROGRAM: CBLFMTCV TASK: 0006742 APPLID: CICSM DISPLAY: 00
STATUS: COMMAND EXECUTION COMPLETE
EXEC CICS READ
FILE ('MQXMLF1 ')
INTO ('CUSTER_RSP11FS20OC03OF20OF10OF10OF20OF10OF03OF10FS10FS10')
LENGTH (80)
RIDFLD ('CUSTER_RSP')
EQUAL
OFFSET:X'000936' LINE:00105 EIBFN=X'0602'
RESPONSE: LENGERR EIBRESP=22
|
|
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Hi,
this vsam accessing program is subprogram. when i try using set option , i am getting severe error on linkage section.
IGYPS0037-S "DFHCOMMAREA" was not a uniquely defined name. The definition to be used could not be determined from the context. The reference to the name was discarded.
I am gettting the VSAM key from calling program in dfhcommarea. |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
Strange that you cant see that the length before the read is:
and the length of the record read is:
Thats why you get the LENGERR.
The DFHCOMMAREA is just a simple cobol-error that you should be able to find out yourself. The errormessage tells you.
If you still have problems with this, show us the code, I mean the real code, otherwise answeres tend to be guesses. |
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Peter cobolskolan wrote: |
Strange that you cant see that the length before the read is:
and the length of the record read is:
Thats why you get the LENGERR.
The DFHCOMMAREA is just a simple cobol-error that you should be able to find out yourself. The errormessage tells you.
If you still have problems with this, show us the code, I mean the real code, otherwise answeres tend to be guesses. |
|
|
Back to top |
|
|
Thamilselvi
New User
Joined: 22 Jun 2012 Posts: 57 Location: Chennai
|
|
|
|
Hi,
I have attached my program. Cn you please chk and help me to sought the length error issue.. |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
removing the ODO also means a SEARCH ALL will not function properly. |
|
Back to top |
|
|
Peter cobolskolan
Active User
Joined: 06 Feb 2012 Posts: 104 Location: Sweden
|
|
|
|
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 |
|
|
|