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

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

Postby dick scherrer » Sat Jul 14, 2012 11:33 pm

Hello,

Which COBOL are you using? There are several available for Win-based systems and *nix.

As far as i know, all of them support the SORT verb. In your COBOL documentation, look for the info about SORT. A SORT statement requires an SD (instead of an FD) and the statement starts like:
SORT SORT-FILE ON ASCENDING. . . .

I've used this on all of the main platforms in use today. While we are mostly a mainframe forum, we may be able to help with COBOL language specific questions. Platform specifics, maybe not as much,

If you are using MicroFocus COBOL, there are sites that host MicroFocus questions - i don't have any links as none of my clients is currently using COBOL on LUW systems.
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 dick scherrer » Sat Jul 14, 2012 11:37 pm

Add on:

As far as logical versus physical files, the way i think of them is that a logical file is what the program works with while the physical file is the actual data on whatever media it resides.

In COBOL the SELECT / ASSIGN connects the logical to the physical.

Probably an over simplification but i find it handy. . .
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 dexik » Sun Jul 15, 2012 9:11 pm

Cool, I will try the SORT verb.

Thank you guys, you're awesome.

NB. Apparently I had a permission to copy the physical file. I copied it to my library and compiled the logical file no problem.
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 dick scherrer » Mon Jul 16, 2012 2:33 am

Hello,

Good luck using SORT - someone will be here if there are questns. One suggestion - do not code the USING/GIVING form as this typically wastes resources. As an expirement, USING / GIVING might be ok, but usually there is sort pre-processing and/or post-processing so coding INPUT PROCEDURE and/or OUTPUT PROCEDURE performs better.

I copied it to my library and compiled the logical file no problem.
If a physical file was copied from one place to another place, it is a new physical file - Not a logical file. I believe there is still confusion between them. . .
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

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post