Writing into VBS files, get S002-18... 
Author Message
 Writing into VBS files, get S002-18...

Either the answer is glaring, or there is a bug
in DFSMSdfp (I am inclined to think it's too
glaring to be seen by my feeble eyes).

I want to write into a VBS file segment by segment
(not on a logical record basis, however I write no
multisegment record here) using QSAM PUT in locate mode.
The doc says this can be done (LRECL=X must be specified
in the DCB).

I get abend S002-18 after 92 records have been written
(note that 92*256=23552 is just when the blocksize is exceeded,
but why should I care ?).

The program is this :

TESTPGM  CSECT
         BAKR  14,0
         LR    R12,R15
         USING TESTPGM,R12
* OPEN VBS FILE
         OPEN  (DDOUT,(OUTPUT))
* PUT LOOP
         XR    R9,R9
LOOP     PUT   DDOUT          PUT RETURNS ADDRESS OF AN I/O ZONE IN R1
         MVC   0(256,R1),ZONE
         LA    R9,1(0,R9)           INCREMENT TALLY
         ST    R9,COUNT
         B     LOOP
DDOUT    DCB   DDNAME=DDOUT,MACRF=PL,DSORG=PS,LRECL=X
         DS    0D
* DATA ZONE
ZONE     DS    0CL256          RECORD CONTAINS 256 BYTES
SDW      DC    X'0100',X'0000'    LENGTH + SEGMENT CTRL CODES
         DC    CL252' WHATEVER DATA'
COUNT    DC    F'0'
         LTORG
R1       EQU   1
R9       EQU   9
R12      EQU   12
R15      EQU   15
         END

The JCL is :

//S1       EXEC PGM=TESTPGM
//STEPLIB  DD DISP=SHR,DSN=MVS.LOAD
//SYSUDUMP DD SYSOUT=*
//DDOUT    DD DISP=(NEW,DELETE),UNIT=SYSALLDA,DSN=&&TEMP,
//  RECFM=VBS,BLKSIZE=23476,LRECL=32760,SPACE=(CYL,(100,100))

And the execution message is :

IEC036I 002-18,IGC0005E,SOFTSTVB,S1,DDOUT

Thanks for any insight.



Thu, 08 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...

Quote:

>TESTPGM  CSECT
>         BAKR  14,0
>         LR    R12,R15
>         USING TESTPGM,R12
>* OPEN VBS FILE
>         OPEN  (DDOUT,(OUTPUT))
>* PUT LOOP
>         XR    R9,R9
>LOOP     PUT   DDOUT          PUT RETURNS ADDRESS OF AN I/O ZONE IN R1

Unless you use BFTEK=A or BUILDRCD, R0 contains the actual length remaining in
the buffer.

From DFSMS/MVS Macro Instructions for Data Sets...

Locate Mode: If you specify locate mode, omit the area address. The system
returns the address of the next available buffer in register 1. This is the
buffer into which your program later places the next record.

When variable-length spanned records are processed without the extended
logical record interface (XLRI), and a record area is provided for a logical
record interface (LRI) (BFTEK=A has been specified in the data control block
or a BUILDRCD macro has been issued), the address returned in register 1
points to an area large enough to contain the maximum record size (up to 32756
bytes). The system segments the record and writes all segments, providing
proper control codes for each segment. If, for variable-length spanned
records, a record area has not been provided, the actual length remaining in
the buffer is returned in register 0. In this case, you must segment the
records and process them in record segments. ISO/ANSI/FIPS spanned records,
RECFM=DS or RECFM=DBS, cannot be processed in segment mode. The record or
segment is not written until another PUT macro is issued for the same data
control block or an FEOV or CLOSE macro is issued.

When a PUT macro is used in the locate mode, the address of the buffer for the
first record or segment is obtained by issuing a PUT macro after open. QSAM
returns the address in register 1. Then, move data to this address. The buffer
is not written to the data set until the next PUT macro is issued. If records
are blocked, the data is not written to the data set until the PUT following
the one that filled the buffer. Each PUT macro returns the address of the next
buffer in register 1. After this address is given to you, QSAM always counts
this address as a valid record. You should always place valid data at the
address returned in register 1 before issuing another PUT or FEOV or CLOSE
macro. Otherwise, residual data at that location is written to the data set.
After issuing an FEOV macro (for multivolume data sets), you must reinitialize
register 1 with the first buffer address for the next volume by issuing a PUT
macro after return from FEOV.

--
No electrons were injured in the preparation of this message.



Thu, 08 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
Thanks, Gilbert Saint-flour (who undoubtedly knows many things)
put me also on the right track...
The point is BFTEK=A gives you a record area, not the usual block area...
LRECL=X is of no use here.
I must admit I do not play very often with VBS files...

Michael Quinlan wrote :

Quote:

>>TESTPGM  CSECT
>>         BAKR  14,0
>>         LR    R12,R15
>>         USING TESTPGM,R12
>>* OPEN VBS FILE
>>         OPEN  (DDOUT,(OUTPUT))
>>* PUT LOOP
>>         XR    R9,R9
>>LOOP     PUT   DDOUT          PUT RETURNS ADDRESS OF AN I/O ZONE IN R1

>Unless you use BFTEK=A or BUILDRCD, R0 contains the actual length remaining
in
>the buffer.



Thu, 08 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
Turned out to be more involved than I expected.  Code below tested
with various block sizes from 50 through 3390 1/2 track.  I generalized
it a little bit.

TESTPGM  CSECT
         BAKR  14,0
         LR    R12,R15
         USING TESTPGM,R12
* OPEN VBS FILE
         OPEN  (DDOUT,(OUTPUT))
         XR    R9,R9               SET COUNT = 0
         LA    R3,1                SET R3 = 1 (COUNT INCREMENT VALUE)
         LA    R2,4                SET R2 = 4 (LENGTH OF AN SDW)
         SR    R5,R5               SET R5 = 0
* PUT LOOP
LOOP     LA    R4,SDW              LOAD START OF DATA IN RECORD
         ICM   R5,B'0011',SDW      LOAD RECORD LENGTH
         PUT   DDOUT          PUT RETURNS ADDRESS OF AN I/O ZONE IN R1
         CR    R0,R5               COMPARE SPACE IN BUFFER W/ RECORD   ?
                                    SIZE
         BNL   FULLMOVE            BR IF NO NEED TO SEGMENT THE RECORD
* COMPLETE RECORD WILL NOT FIT IN BUFFER
* WRITE THE FIRST SEGMENT
         STCM  R0,B'0011',0(R1)    STORE REMAINING RECORD LEN IN LENGTH
         MVI   2(R1),B'00000001'   INDICATE 1ST SEGMENT
         MVI   3(R1),0             COMPLETE THE SDW
* R4 IS A RECORD POINTER
* R5 IS REMAINING LENGTH TO MOVE
         AR    R4,R2               COMPUTE START OF DATA TO MOVE
         SR    R5,R2               COMPUTE FULL LENGTH OF DATA TO MOVE
         LR    R15,R0              COPY SEGMENT LENGTH TO R15
         LA    R14,0(R2,R1)        COMPUTE START OF DATA IN OUTPUT     ?
                                    BUFFER
         SR    R15,R2              COMPUTE 1ST LENGTH TO MOVE
         MVCL  R14,R4              COPY A SEGMENT
* AFTER THE MOVE, R4 POINTS TO THE RESUME POINT IN THE INPUT BUFFER,
* AND R5 CONTAINS THE REMAINING LENGTH IN THE INPUT BUFFER
NEXTSEG  PUT   DDOUT               GET SPACE FOR THE NEXT SEGMENT
         MVI   3(R1),0             COMPLETE THE SDW IN THE             ?
                                    OUTPUT BUFFER
         LA    R15,0(R2,R5)        COMPUTE MAX SIZE FOR THIS SEGMENT
         CR    R0,R15              COMPARE SPACE IN BUFFER W/ MAX      ?
                                    SIZE FOR THE SEGMENT
         BNL   LASTSEG             BR IF NOT LAST SEGMENT
         MVI   2(R1),B'00000011'   INDICATE MIDDLE SEGMENT
         STCM  R0,B'0011',0(R1)    STORE SEGMENT LENGTH
         LR    R15,R0              COPY SEGMENT LENGTH TO R15
         LA    R14,0(R2,R1)        COMPUTE START OF DATA IN SEGMENT
         SR    R15,R2              COMPUTE LENGTH TO MOVE
         MVCL  R14,R4              COPY NEXT SEGMENT
         B     NEXTSEG             AND CONTINUE ON
LASTSEG  MVI   2(R1),B'00000010'   INDICATE LAST SEGMENT
         STCM  R15,B'0011',0(R1)   STORE SEGMENT LENGTH IN THE SDW
         LA    R14,0(R2,R1)        COMPUTE START OF DATA IN SEGMENT
         SR    R15,R2              COMPUTE LENGTH TO MOVE
         MVCL  R14,R4              COPY REMAINING PART OF SEGMENT
         B     MOVED               AND BE DONE WITH IT
FULLMOVE LR    R15,R5              COPY LENGTH TO MOVE TO R15
         LR    R14,R1              COPY ADDRESS TO MOVE TO R15
         MVCL  R14,R4              COPY ENTIRE RECORD TO OUTPUT BUFFER
MOVED    AR    R9,R3               INCREMENT TALLY
         ST    R9,COUNT            UPDATE THE COUNT
         B     LOOP                AND GO DO THE NEXT RECORD
         PUSH  PRINT
         PRINT NOGEN
DDOUT    DCB   DDNAME=DDOUT,MACRF=PL,DSORG=PS,LRECL=X,RECFM=VBS
         POP   PRINT
         DS    0D
* DATA ZONE
ZONE     DS    0CL256          RECORD CONTAINS 256 BYTES
SDW      DC    AL2(SDWL),X'0000'    LENGTH + SEGMENT CTRL CODES
*        DC    CL252' WHATEVER DATA'
* THE FOLLOWING OUTPUT BUFFER MAKES IT WASIER TO "EYEBALL" THE
* OUTPUT RECORDS
         DC    C'----+----1----+----2----+----3----+----4'
         DC    C'----+---50----+----6----+----7----+----8'
         DC    C'----+----9----+--100----+----1----+----2'
         DC    C'----+----3----+----4----+--150----+----6'
         DC    C'----+----7----+----8----+----9----+--200'
         DC    C'----+----1----+----2----+----3----+----4'
         DC    C'----+--250--'
SDWL     EQU   *-SDW
COUNT    DC    F'0'
         LTORG
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
         END

The JCL is :

//S1       EXEC PGM=TESTPGM
//STEPLIB  DD DISP=SHR,DSN=MVS.LOAD
//SYSUDUMP DD SYSOUT=*
//DDOUT    DD DISP=(NEW,DELETE),UNIT=SYSALLDA,DSN=&&TEMP,
//  RECFM=VBS,BLKSIZE=23476,LRECL=32760,SPACE=(CYL,(100,100))

-- Steve Myers


Quote:
>Either the answer is glaring, or there is a bug
>in DFSMSdfp (I am inclined to think it's too
>glaring to be seen by my feeble eyes).

>I want to write into a VBS file segment by segment
>(not on a logical record basis, however I write no
>multisegment record here) using QSAM PUT in locate mode.
>The doc says this can be done (LRECL=X must be specified
>in the DCB).

>I get abend S002-18 after 92 records have been written
>(note that 92*256=23552 is just when the blocksize is exceeded,
>but why should I care ?).

>The program is this :

[snip]

>And the execution message is :

>IEC036I 002-18,IGC0005E,SOFTSTVB,S1,DDOUT

>Thanks for any insight.






Fri, 09 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
Just as a comment.

When you say a data set has "standard" length records (the term is not
spanned, by the way, it's standard), and it has variable length records,
then it always -- well, almost always -- has some actual spanned records.
The program in my first post writes spanned multi-segment records that can
be, theoretically, any length at all.

If the maximum logical record length is less than 32768, then it is much
easier to use BFTEK=A and just use a PUT macro.  The rather involved code
I wrote is really only useful when the maximum lrecl is greater than 32767.

-- Steve Myers



Fri, 09 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
Steve Myers wrote ...

Quote:
>(snip)The rather involved code...

Thanks Steve, it may be helpful, although I prefer BFTEK=A...

Quote:
>...I wrote is really only useful when the maximum lrecl is greater than
32767.

But this happens only in very special cases (DFSMSdss tape backups ?).
BSAM is perhaps more handy then.



Fri, 09 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...


Quote:
> When you say a data set has "standard" length records (the term is not
> spanned, by the way, it's standard), and it has variable length records,
> then it always -- well, almost always -- has some actual spanned records.

The last time I looked, standard (RECFM=FBS) means that all blocks are full
length, except possibly the last, whereas non-standard (RECFM=FB) can have
truncated blocks in the middle.  All blocks are multiple of LRECL though.

Spanned is the term connected to variable records spanning more than one
block (RECFM=VBS), as opposed to non-spanned (RECFM=VB).

Or is my knowledge out of date?

Gunnar Opheim.



Sat, 10 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
From a semantic point of vew, you have to have spanned records to have
"standard" length variable length blocks.  This is not true for fixed
length blocks.

The purpose of standard length blocks is for all records (except, as you
noted, the last record) to be the same length.  The best you can do with
variable length records is control the record length to within 4 bytes,
but that is still better than to have truly variable length records.

I lived through the introduction of standard length records, and did not
really understand what it was all about then.  Even now, I think the only
reason to justify the restrictions (the biggest one is you cannot legally
MOD a standard length file, because that would make the last block a short
block, followed by standard length blocks) was RPS.  Fixed length blocks
make the RPS calculations simpler.

The reality is that

- Files are rarely extended by the MOD option or OPEN EXTEND

- Fixed length record files are already fixed length, for the most
  part

- An intelligent way to get a sector for the next record is to command
  chain a Read R0 command followed by a Read Sector command after a read
  command.  This returns a useful sector, without going through the
  arithmetic.  Using this approach makes the idea of standard length
  records essentially worthless for variable length records, and makes RPS
  useful for U format data sets.

- In any event, who cares any more?  Caching controllers and RAID storage
  make rotational positioning issues moot.  In addition, the methods used
  starting with SAM-E (and now in DFSMS) also make knowledge of rotational
  position less necessary.

-- Steve Myers


Quote:


>> When you say a data set has "standard" length records (the term is not
>> spanned, by the way, it's standard), and it has variable length records,
>> then it always -- well, almost always -- has some actual spanned records.

>The last time I looked, standard (RECFM=FBS) means that all blocks are full
>length, except possibly the last, whereas non-standard (RECFM=FB) can have
>truncated blocks in the middle.  All blocks are multiple of LRECL though.

>Spanned is the term connected to variable records spanning more than one
>block (RECFM=VBS), as opposed to non-spanned (RECFM=VB).

>Or is my knowledge out of date?

>Gunnar Opheim.



Sat, 10 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...

Quote:
> I lived through the introduction of standard length records, and did not
> really understand what it was all about then.

Something about not having to check the IOB count field after every read.

--
Alex Vrenios
Ph.D. Student
Computer Science Dept.



Sat, 10 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
BS.  Last block issues require you to check it every time if you're using
READ/CHECK.


Quote:
>> I lived through the introduction of standard length records, and did not
>> really understand what it was all about then.

>Something about not having to check the IOB count field after every read.

>--
>Alex Vrenios
>Ph.D. Student
>Computer Science Dept.




Sat, 10 Aug 2002 03:00:00 GMT  
 Writing into VBS files, get S002-18...
Yes, that's right: the last one can be short. If it's just FB, technically,
they can all be short so you should be checking for BSAM - QSAM takes care
of this for you. The "S" saves a few insructions is all. The S in VBS is
for Spanned, meaning a logical record can cross physical record boundaries.
The length fields are inside these records (physical and logical, if blocked),
so no knowledge of the IOB count is necessary.


Quote:

>BS.  Last block issues require you to check it every time if you're using
>READ/CHECK.


>>> I lived through the introduction of standard length records, and did not
>>> really understand what it was all about then.

>>Something about not having to check the IOB count field after every read.

>>--
>>Alex Vrenios
>>Ph.D. Student
>>Computer Science Dept.


--
Alex Vrenios
Ph.D. Student
Computer Science Dept.



Sun, 11 Aug 2002 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Getting rid of Magistr.b @ VBS.LoveLetter virus out of RESTORE directory

2. Error 18 No More Files

3. Q: Performing INSPECT on Tab-delimited File in MFCOBOL V3.4.18

4. Writing and getting info from file

5. Problem : File gets deleted when a read and write operation is attempted

6. Execute a VBS file from Clarion

7. Running vbs file from TCL

8. turn off VBS+VBE files??

9. Reminder: Dave Thomas to speak at OCSTUG, Sept 18

10. Smalltalk Solutions Press Release 18 April 2003

 

 
Powered by phpBB® Forum Software