Wednesday, December 7, 2011

COBOL : UT-S- and AS- used with ASSIGN clause

In some programs you would have noticed ASSIGN clauses like this :

SELECT INPUT-FILE ASSIGN TO UT-S-DDNAME

or

SELECT INPUT-FILE ASSIGN TO AS-DDNAME

What is the significance of "UT-S-" and "AS-" ?

In general,

Assign clause should be coded in the following format,
label-org-name

Label
Label documents the  device  and  device  class  to  which  a  file  is assigned.If specified,it must end with a hypen.

Org
Org must be specified as AS for VSAM sequential files,  must be omitted for VSAM indexed and relative files,  and may  be  specified  as  S  or omitted for QSAM files.  If specified, it must end with a hyphen.
  
For a "unit record" QSAM file associated with a ddname of  SYS001,  the ASSIGN clause can be coded in any one of the three forms shown below:   
                                                                     
ASSIGN TO SYS001                                                   
ASSIGN TO S-SYS001                                                 
ASSIGN TO UR-S-SYS001                                                 
      
Name
DDname used in the jcl for the file.


Following is the more detailed explanation of the usage select clause using : UT-S

SELECT <file1> ASSIGN TO
   (system number)-UT/-(Device Number)-S/-(External Name)
                   UR/                 I/
                   DA                  R/
                                       D

System Number - eg : SYS004 Refers to the device

UT -  Utility (Sequential)
UR - Unit Record(Terminal or Printer)
DA - Direct Access(Disk)

Device Number : Supplied by computer manufacturer
Method of organisation: S - Sequential
                       I,R,D - used for disk files
External Name : Any name you give

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.