Page 1 of 2

Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 5:18 am
by dexik
There's a physical file that I can't alter and it doesn't have key. I created a logical file with a key but it won't let me compile because I don't have authority to the physical file.

Is there a way to open a physical file without using a logical file and sort it by one of the columns?

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 6:36 am
by Robert Sample
You posted in the COBOL section. The COBOL Language Reference manual Glossary defines logical record but not logical file. Since you are making up your own terminology, rather than using standard terms, exactly what do you consider to be a "logical file"?

Broadly speaking, if you don't have read access to a data set, then you cannot do anything with that data set -- so sorting would definitely be out. If you have read access, you could sort a temporary data saet that is a copy of the actual data set, but you could not replace the data set without having at least update authority.

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 9:20 am
by dick scherrer
Hello,

If you explain where you really are stuck, maybe someone can help. . .

Why do you believe the file needs a "key"? What is the file type (QSAM, VSAM, other)? Why are you concerned about logical or physical files?

Most files can be sorted by "one of the columns" and a new, resequenced file written by simply using your sort product.

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 7:36 pm
by Anuj Dhawan
Trying to read between the lines, did you mean to say something like this:

SELECT <logical-file> ASSIGN TO <physical-file>.

when you mentions "logical" & "physical" in your post.

But if so, this
I created a logical file with a key but it won't let me compile because I don't have authority to the physical file.
from your post does not make any sense in COBOL world. When COBOL program is complied, the existence of Physical-file does not even matter, let alone the authority to edit it! So the question remains -- what is that you are asking, to start with?

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 8:51 pm
by dexik
Logical and physical files are the terms used by our teacher, so that's what we use too.

This is what the physical file holds. As you can see the School column is not sorted.
http://i49.tinypic.com/2mwtqpy.jpg

I create a logical file in RDP like this. I add a member and choose LF i.e. logical file.
http://i49.tinypic.com/6o3fpu.jpg

This is what inside the so called 'logical file':
http://i45.tinypic.com/m7gv7.jpg

As you can see the key is School and it references the above physical file. So when I read the physical file it will read it sorting by School column. The physical file is not located in my so called directory and I don't know if the authority for that file is set right because when I compile the 'logical file' it gives me the following error:

Not authorized to library *N. -- Not authorized to member *N. -- Not authorized to file CHAP8AS4 in library QGPL. -- The user profile of the owner of file CHAP8AS4LF in library DK344A10 does not have *ADD authority. -- The group user profile does not have *ADD authority.

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 8:52 pm
by dexik
Oops sorry, the School column is the fifth from the left.

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 9:03 pm
by Akatsukami
The image of an iSource dialog indicates that you are working with a LUW COBOL dialect, not a mainframe one. You will not find a answer here.

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 9:04 pm
by dexik
So the problem is how do I open that physical file and sort it by School column while reading it? It must be sorted because we are being taught Control break processing.

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 9:06 pm
by dexik
Okay, when I google LUW COBOL forum the search comes up empty. Where do I find forums?

Re: Read a physical file that doesn't have a logical file?

PostPosted: Sat Jul 14, 2012 9:22 pm
by Akatsukami
You might try jazz.net. A warning though: we're patient and kindly mentors here...compared to the sempai you will find on most fora and mailing lists, especially the LUW (Linux/Unix/Windows) oriented ones. Make very sure to RTFM and STFW before asking a question that turns out to have been asked a myriad of times by a myriad of clueless sotfware engineers; you will not like the results otherwise.