Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COBOL file handling

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
KSKPRIYA
Currently Banned

New User


Joined: 25 May 2012
Posts: 3
Location: INDIA

PostPosted: Fri May 25, 2012 10:13 pm    Post subject: COBOL file handling
Reply with quote

Why do we need a logical and a physical file name for a file in cobol file handling..?? i understand the importance of physical file name as re-usability of the compiler JCL but what is with the logical name??
Back to top
View user's profile Send private message

KSKPRIYA
Currently Banned

New User


Joined: 25 May 2012
Posts: 3
Location: INDIA

PostPosted: Fri May 25, 2012 10:14 pm    Post subject: JCL priority parameter
Reply with quote

what does prioroty 144 for a jOB indicate? I thot the priorities are only as 1-15.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri May 25, 2012 11:04 pm    Post subject: Re: COBOL file handling
Reply with quote

KSKPRIYA wrote:
Why do we need a logical and a physical file name for a file in cobol file handling..?? i understand the importance of physical file name as re-usability of the compiler JCL but what is with the logical name??

Your question is confused, possibly because you do not use standard terminology.

A data set is a named collection of data on a physical device. Toy computers often use the term "file" for this, but on a mainframe a file is the logical representation of a data set.

In z/OS the link between a data set and a file is in the JCL, thus:
Code:
//PATIENCE JOB
//STEPONLY EXEC PGM=RORA
//FOO      DD   DSN=BAR,DISP=SHR

Here FOO is the file, which is this instance represents the data set BAR. A COBOL program would coded something like:
Code:
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT THIS-FILE ASSIGN TO FOO-S.
DATA DIVISION.
FILE SECTION.
FD THIS-FILE.
01 THIS-RECORD.
    etc.

If this seems complex, remember that COBOL is a universal programming language, not just a mainframe language. Toy computers often lack any equivalent of JCL, requiring that the logical/physical linkage be defined in the program itself. Thus, writing a MicroFocus COBOL program to run on a Wintel box, you would code
Code:

    SELECT THIS-FILE ASSIGN TO "C:\FOO\BAR.DAT"
    ORGANIZATION IS SEQUENTIAL.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7909
Location: Bellevue, IA

PostPosted: Fri May 25, 2012 11:37 pm    Post subject:
Reply with quote

The closest I can think of to what your question seems to be about is to quote the COBOL Language Reference manual:
Quote:
5.1.5.1 File data




File data is contained in files. (See "File section" in topic 5.2.1.) A file is a collection of data records that exist on some input-output device. A file can be considered as a group of physical records; it can also be considered as a group of logical records. The data division describes the relationship between physical and logical records.

A physical record is a unit of data that is treated as an entity when moved into or out of storage. The size of a physical record is determined by the particular input-output device on which it is stored. The size does not necessarily have a direct relationship to the size or content of the logical information contained in the file.

A logical record is a unit of data whose subdivisions have a logical relationship. A logical record can itself be a physical record (that is, be contained completely within one physical unit of data); several logical records can be contained within one physical record, or one logical record can extend across several physical records.
File description entries specify the physical aspects of the data (such as the size relationship between physical and logical records, the size and names of the logical records, labeling information, and so forth).

Record description entries describe the logical records in the file (including the category and format of data within each field of the logical record), different values the data might be assigned, and so forth. After the relationship between physical and logical records has been established, only logical records are made available to you. For this reason, a reference in this information to "records" means logical records, unless the term "physical records" is used.

And as far as your second post goes, you'll need to clarify your question. There is job priority, dispatch priority, JES priority -- in other words, there is not just ONE priority in a z/OS system to make your question easy to answer.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Sat May 26, 2012 12:08 am    Post subject:
Reply with quote

Hello and welcome to the forum,

Quote:
Why do we need a logical and a physical file name for a file in cobol file handling..?? i understand the importance of physical file name as re-usability of the compiler JCL but what is with the logical name??
I believe you have considerable confusion here. . .

In a COBOL SELECT statement you provide both the file name that will be used for the compiler and you provide the name that relates the program to the physical file:
SELECT COMPILE-NAME ASSIGN TO S-MYFILE.
COMPILE-NAME will be used throughout the program code (open/close/read).
S-MYFILE will be used in the "JCL" to relate the actual dataset to your program.
Quote:
It must be either the name specified in the DD statement for this file or the name of an environment variable that contains file allocation information.


As far as i know, this has nothing to do with the reuse of the compiler JCL. . .
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Tue May 29, 2012 1:18 pm    Post subject: Re: COBOL file handling
Reply with quote

KSKPRIYA wrote:
Why do we need a logical and a physical file name for a file in cobol file handling..?? i understand the importance of physical file name as re-usability of the compiler JCL but what is with the logical name??
There are some rules of every game you need to abide by. The logical file includes the record layout. The physical file includes the name of the file on the disk and the information on how the file will be organized.

I'll try an example, in lay-man terms, think about a situation, where you need a physical-file to be used in two differnt COBOL programs. The structure of file is:
Code:
EMPLOYEE-DEPT-NO  PIC 9(3)
UNIQUE-IDENTITY     PIC 9(3)

First Program (PGM1) uses the file as shown above while the second program needs employee-number as input. Employee-number is a 6-digit number, which is a combination of employee-dept and unique-identity. Now as a programmer how would one differntiate two different inputs from the same physical file? One have to have a layout of input-file in the program. And when you've multiple files, you would want to refer them seprately. The solution comes in the form of "logical file name".
Back to top
View user's profile Send private message
KSKPRIYA
Currently Banned

New User


Joined: 25 May 2012
Posts: 3
Location: INDIA

PostPosted: Wed May 30, 2012 9:27 pm    Post subject:
Reply with quote

ohkkk... thank you.. it was quite useful icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu May 31, 2012 1:57 pm    Post subject:
Reply with quote

Glad to hear that curiosity subsides with a smile! icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us