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



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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

Postby dexik » Sat Jul 14, 2012 5:18 am

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?
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Robert Sample » Sat Jul 14, 2012 6:36 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

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

Postby dick scherrer » Sat Jul 14, 2012 9:20 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

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

Postby Anuj Dhawan » Sat Jul 14, 2012 7:36 pm

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?
Anuj
Anuj Dhawan
 
Posts: 273
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times

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

Postby dexik » Sat Jul 14, 2012 8:51 pm

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.
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby dexik » Sat Jul 14, 2012 8:52 pm

Oops sorry, the School column is the fifth from the left.
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Sat Jul 14, 2012 9:03 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby dexik » Sat Jul 14, 2012 9:04 pm

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.
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby dexik » Sat Jul 14, 2012 9:06 pm

Okay, when I google LUW COBOL forum the search comes up empty. Where do I find forums?
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Sat Jul 14, 2012 9:22 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post