IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Variable length file and a missing value


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
meenakshi_forum
Warnings : 1

Active User


Joined: 27 May 2008
Posts: 121
Location: India

PostPosted: Thu Jan 07, 2010 11:54 pm
Reply with quote

What will happen if for a field in a Variable Length file , value is missing?

Is it possible to view a VB length file with a copy book, i am not sure here, may be we can; so if we can then will we get missing value for that field? So to avoid such cases do we have something equivalent to Null/Not Null in DB2?

If we don't get missing value in the o/p file then how would the file look like?

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri Jan 08, 2010 12:13 am
Reply with quote

Every byte of a file has a value. There is no concept of NULL or missing data in files. NULL applies only to databases, not files. The value of the byte may be a displayable character (such as R or 3) or it may not be displayable (such as x'00') but every byte has a value.

You can view a VB file with a copy book using File Aid or similar tools. If there is a variable number of occurrences for a record, when the record ends there is no more data to see -- the screen is blank and you will not see anything there if you turn HEX ON.

This is very similar to your other question. You need to dump the concept of NULL from your mind when dealing with files -- there is no such thing as NULLs in files (repeat this until you comprehend it).
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Jan 08, 2010 8:28 pm
Reply with quote

meenakshi_forum wrote:
What will happen if for a field in a Variable Length file , value is missing?
Don't touch that file - that's a time bomb, can explode in any program anytime...beware!
Back to top
View user's profile Send private message
meenakshi_forum
Warnings : 1

Active User


Joined: 27 May 2008
Posts: 121
Location: India

PostPosted: Fri Jan 08, 2010 11:35 pm
Reply with quote

Thanks,

If there is a missing value in the middle of a record then what will happen?

Will the record remain intact?

I am bit confused as in a discussion i came across that the record in the file would shrink, and that raised a doubt that then how it could be viewed using copy book, how we will know the right place of any field value?

Also if the record shrinks then even in 3.4 we will not get proper results.

Please check me, i feel there is something wrong.

One more thing, if there can be displayable /non displayable character for missing value as mentioned above then how come there will not be any such value at the end of the record for a missing value case.

Please correct me if i am going wrong somewhere.

Thanks


Thanks.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri Jan 08, 2010 11:43 pm
Reply with quote

Quote:
Please correct me if i am going wrong somewhere.
You are going wrong. A file cannot -- please note carefully CANNOT -- have missing values in the middle of a record. First of all, outside of a database (or a language such as SAS) there is no such thing as a missing value. A file is not a database, it is a file -- so the concept of missing value has no meaning to a file.

I recommend you go back and review the discussion you are referencing. I think you will find the meaning was the bytes were deleted from the middle of the record, not that there was missing data -- because there is no such thing as missing values in a file.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jan 09, 2010 1:24 am
Reply with quote

Hello,

Quote:
Please correct me if i am going wrong somewhere.
Yes, you are.

Variable records may become longer or shorter (hence the term variable). This does not mean there is something missing.

Two common ways to have variable length data are to:
Have multiple record layouts of different length
and/or
Have OCCURS DEPENDING ON as part of the record definition.

In neither case is anything missing.

And yes, looking at variable length data via EDIT or BROWSE might be confusing if you do not understand the data layout.

Quote:
Also if the record shrinks then even in 3.4 we will not get proper results.
Not true - the data will be the data. It is up to you to understand the data.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sat Jan 09, 2010 7:15 am
Reply with quote

Quote:
I am bit confused as in a discussion i came across that the record in the file would shrink,...

Only if the record was made of wool, or if left in the dryer too long. icon_lol.gif
Back to top
View user's profile Send private message
meenakshi_forum
Warnings : 1

Active User


Joined: 27 May 2008
Posts: 121
Location: India

PostPosted: Mon Jan 11, 2010 12:58 am
Reply with quote

Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top