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 

Query in Write

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


Joined: 28 Jul 2004
Posts: 18
Topics: 3

PostPosted: Thu Dec 16, 2004 12:57 am    Post subject: Query in Write Reply with quote

Hello Board,

I have used following code -
Code:
 FD CRF-FILE.
 01 CRF-RECORD.
      05 ....
      05 ....
      .
      .
      05 CRF-CATEGORY      PIC 9(05)
      .
      .

And after all processing...

     WRITE CRF-RECORD.


Now I tried to display CRF-CATEGORY just before and after WRITE. But in some cases, after WRITE the field is showing null value though before write it is showing value. WRITE status is successfull.
Why is it like that? I know more information is required, but please let me know what more is required?

Regards,
Sandip.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Dec 16, 2004 1:13 am    Post subject: Reply with quote

Sandip,

After the WRITE statement is executed, the logical record is no longer available in CRF-RECORD unless the WRITE is un-successful.

Check the following link for more info.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3LR20/6.2.40.5?SHELF=&DT=20040227004926&CASE=

At the same time if you use WRITE logical-record FROM identifer then the data in "identifier" is preserved.

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
sandip
Beginner


Joined: 28 Jul 2004
Posts: 18
Topics: 3

PostPosted: Thu Dec 16, 2004 1:33 am    Post subject: Reply with quote

Hi Phantom,
I understand and thank you for your information.
Can you please suggest how the value changes if we try to display the same? Is it random?

Regards,
Sandip.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Dec 16, 2004 1:45 am    Post subject: Reply with quote

Sandip,

In ur first post, You said:
Code:

after WRITE the field is showing null value though before write it is showing value


You said the correct thing, the data will be available before WRITE but after WRITE it is emptied.

Code:

how the value changes if we try to display the same? Is it random?


Do you mean to say in SOME instances u can see the value in CRF-CATEGORY after the WRITE statement is issued? If so, check whether the WRITE status is successful in these cases. Are u using FILE-STATUS to monitor the WRITE status or u look at the output file ?

Thanks,
Phantom
Back to top
View user's profile Send private message
sandip
Beginner


Joined: 28 Jul 2004
Posts: 18
Topics: 3

PostPosted: Thu Dec 16, 2004 2:49 am    Post subject: Reply with quote

Phantom,
Yes, I can see in some cases values are changing/does not changing after WRITE is issued successfully (I have checked the file status). The output file shows correct value i.e., the value before WRITE.

Regards,
Sandip.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Dec 16, 2004 4:00 am    Post subject: Reply with quote

Not quite sure how/why this happens. Probably someone else could provide a solution.

Thanks,
Phantom
Back to top
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Thu Dec 23, 2004 7:30 am    Post subject: Reply with quote

FD CRF-FILE.
01 CRF-RECORD.
05 ....
05 ....
.
.
05 CRF-CATEGORY PIC 9(05)
.
.

I am also facing the same type of problem. When I tried to write a record after changing only CRF-CATEGORY, it is writing only the CRF-CATEGORY in the file with some junk in the other fields, which is unchanged.

But when I tried to run the Job by making the output file as SYSOUT, it is working Fine.

Quote:
After the WRITE statement is executed, the logical record is no longer available in CRF-RECORD unless the WRITE is un-successful


If this is the case, then how could it is able to write the proper full record data in SYSOUT. I feel SYSOUT is also type of data set with some relaxation.

Can any one throw some light on this? Thanks in advance.

PS: Its working when i move the values to the other fields every time before writing, just want to know how it's working fine in SYSOUT.
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Thu Dec 23, 2004 10:13 pm    Post subject: Reply with quote

When a rec is written from the FD rec desription, the rec desc is pointing to a buffer segment (in memory) managed by the access method. When the rec is written the pointer is bumped to the next segment. Since it hasn't been filled by the pgm code, the buffer area probably contains binary zeros (not guaranteed).

The data you moved into the buffer segment before the write is no longer available after the write. The new sement is awaiting new data. The old data may still be in the buffer but the pgm has no way to access it because the poinnter has been adjusted for the next write.
_________________
Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
Back to top
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Fri Dec 24, 2004 12:01 am    Post subject: Reply with quote

Jack,
Thanks for your response.

Quote:
The data you moved into the buffer segment before the write is no longer available after the write


Then How come it's writing the record into a SYSOUT correctly all the time , I fell sysout is also a form of dataset, please correct me if i am wrong.
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
haatvedt
Beginner


Joined: 14 Nov 2003
Posts: 66
Topics: 0
Location: St Cloud, Minnesota USA

PostPosted: Fri Dec 24, 2004 3:15 am    Post subject: Reply with quote

Sivaraj,

if you direct a file to sysout, then it is NOT blocked. Since JES files are not blocked and do not use buffers, the record pointer is not advanced and the record is available after the write statement.

ps.. this is a common bug when converting a file from sysout / JES to DASD or Tape.

Happy Coding...
_________________
Chuck Haatvedt

email --> clastnameatcharterdotnet

(replace lastname, at, dot with appropriate
characters)
Back to top
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Fri Dec 24, 2004 4:14 am    Post subject: Reply with quote

Thanks Chuck . Very Happy
_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Dec 24, 2004 9:44 am    Post subject: Reply with quote

Slade,

Code:

The old data may still be in the buffer but the pgm has no way to access it because the poinnter has been adjusted for the next write.


The original requestor of this question was raising a concern that sometimes he could see the data after write and sometimes not. When the pointer is adjusted to the next segment of the buffer, either it should display some junk value or low-values. But I don't understand why we are getting the last written record there. Any thoughts ? (Did I mis-interpret your statement by any chance ?)

Thanks,
Phantom
Back to top
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Fri Dec 24, 2004 5:02 pm    Post subject: Reply with quote

Hi Phantom,

I don't know this for a fact, but I suspect that the last rec written from a buffer can be "seen" because the fetch for a new buffer is delayed until the next write.

Remember that the actual physical write doesn't occur until the buffer is full or at close.
_________________
Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Sat Dec 25, 2004 6:11 am    Post subject: Reply with quote

Hi Slade,

Code:

Remember that the actual physical write doesn't occur until the buffer is full or at close.


I think u solved the mystery. Until the output buffer becomes full, sandip was able to see the data in the FD section entry. Once the data is written physically the output buffer might have been flushed and it displays NULL / JUNK values.

Sandip,
Is the RECFM of your output file FB ? If so and if the above assumption is true then the display must follow some pattern. For example for every 3rd record your FD section data should vanish. I hope I'm clear. Assume the output buffer can accomodate 3 output records. So, the first 3 WRITE operation will not be physical. After the 3rd WRITE, the buffer becomes full and writes the data physically and flushes the buffer.

Could you please check your SYSOUT to see whether it follows some pattern ? It might be diffcult to check for VB file since the overflow of buffer depends on the length of each record.

Thanks,
Phantom
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