MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Assembly language : Sequential file reading

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Tue Jun 14, 2011 6:41 am    Post subject: Assembly language : Sequential file reading Reply with quote

A file is defined in assembly language as VB (Variable Block) where first record contains 5000 characters while 2nd record is of 10 bytes.

Above file opened in read mode. We want to write 1st record in one output sequential file if first character of 2nd record is 'A'.

How can we do it.

Will locate mode (defined in MACRF) will help in it ?
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Tue Jun 14, 2011 6:07 pm    Post subject: Reply with quote

searched for macrf locate mode and this is the first link i got - http://csc.colstate.edu/woolbright/QSAM.HTM
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
zatlas
Beginner


Joined: 17 Dec 2002
Posts: 43
Topics: 4

PostPosted: Sun Jun 26, 2011 12:26 am    Post subject: Reply with quote

Like any language, you need to store the first record in a reliable memory storage before you read the next one. You may not rely on MACRF=GL because that memory in the buffer is bound to be reused by QSAM at the next READ and is not under your control. If you know what is your maximum record length then you may define it as a memory chunk (i.e. DC 5000C) and use the regular MACRF=GM. If you do not, you may use GETMAIN to store the first record (after you used MACRF=GL.) You may reuse that storage after you write the first record for the next iteration. Once you get a record that is longer then the original GETMEM, you may issue a FREEMAIN and GETMAIN for the longer record, and so on.
ZA
Back to top
View user's profile Send private message
rnanavaty
Beginner


Joined: 12 Apr 2006
Posts: 29
Topics: 20

PostPosted: Mon Jun 27, 2011 7:32 am    Post subject: Reply with quote

Thanks ZA !!!

It looks fine.

One query regarding this. How we will come to know that GETMAIN defined the memory enough to contain the record. Will it provide error if defined memory location is not enough or overwrite next memory location.

One more thing...Will it require change in program again and again to change memory defined by GETMAIN.
Back to top
View user's profile Send private message
asr2
Beginner


Joined: 25 Jun 2011
Posts: 26
Topics: 4
Location: Germany

PostPosted: Wed Jul 27, 2011 11:44 am    Post subject: Reply with quote

Considering the GETMAIN size. There are two possibilities: either access the file attributes (with the RDJFCB = Read Job File Control Block to obtain the maximum record length) or use a "sledge hammer" approach to allocate the maximum possible record length of 32K.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group