View previous topic :: View next topic
|
Author |
Message |
gokuldass
New User
Joined: 18 Mar 2005 Posts: 48 Location: india
|
|
|
|
Hello Guys,
How to access a variable length record from varible block file? What are the changes that I need to do on the DCB parameter to access a variable length file..
Also, how to define the assembler variable for varible length record.
Please let me know with a sample code & explaination.
Thanks in advance.
Regards,
Gokuldass |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
Specify RECFM=VB in the DCB.
The normal GET will provide you the records you read.
When you want to write such records you have to provide the length field.
Definition of an area, in wich you read the record is done in normal way.
Must be max-size, the records can have.
Regards, UmeySan |
|
Back to top |
|
|
TizMe
New User
Joined: 05 Jan 2006 Posts: 72
|
|
|
|
Don't forget to clear your data area before loading your input record to ensure that you don't get residual data from a previous longer record.
Code: |
MVI DATA,C' '
MVC DATA+1(length),DATA |
|
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi TizMe !
That's correct. But what's about the VarLength? And what is, if Lrecl is grater 255Bytes?
According to your example, you also can do this by an XC instruction.
XC record,record ...set all bytes of record to hex-zero
I think, best way for variable cleaning is to use a MVCL instruction.
S3L00 DS 0H Delete the InOutSentence
L R4,AS3SATZ ...Adress of Sentence
L R5,=A(30000) ...Max Length
*
LA R2,S3LHNULL ...Init Field Hex Zero
SR R3,R3 ...Clean Register 3
ICM R3,8,=X'00' ...DeleteCharacter is Hex Zero
*
MVCL R4,R2 ...Clear the whole Sentence 30.000 Bytes
In stead of "L R5,=A(30000)" you could load the actual length of the actual record into register 5. Use the LengthBytes of the record.
Regards, UmeySan |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi TizMe !
I forgot something, sorry.
In your example, you have to take care of the fields defined after DATA.
MVI DATA,C' '
MVC DATA+1(length),DATA
Here length has to be "LengthOfData - 1Byte"
MVC DATA+1(L'DATA-1),DATA
You also can define one Byte before the field called DATA for only use of cleaning an then using this field in your command. No use of length.
DC CL01' '
DATA DC CL80' '
MVC DATA,DATA-1
Regards, UmeySan |
|
Back to top |
|
|
|