Wednesday, February 29, 2012

Primary Option Menu in File-Aid





BROWSE/EDIT MODE - INITIAL DATA DISPLAY MODE

    Four styles of data display are available when viewing your data file
    records: C (Character), F (Formatted), V (Vertical format), U (Unformatted).

    The MODE field lets you choose the display style you want to see first.
    After the initial display, you use commands (CHAR, FMT, VFMT, UNFMT) to
    switch your display mode as often as you like.  Valid MODE values,
    switching commands and restrictions are as follows:

C CHARACTER - Full screen ISPF-like display of records, one record per
        line.  Overtype data to make changes.  Use HEX command to view hex
        values.  Use FMT command to switch to formatted mode, VFMT to switch
        to vertical formatted mode, UNFMT command to switch to unformatted
        mode.  Use line and primary commands to work with data.

  V VERTICAL  - Requires a single record layout only.  Like character, a
        full screen display of data, one record per line, but data is described by the record layout provided.  Use CHAR to switch to character mode, FMT to switch to formatted mode, UNFMT to switch to unformatted mode.  Use HEX command to view hex values.

Monday, February 27, 2012

HOW TO COPY FROM ONE FILE TO ANOTHER

1.       /A  TS301 – ENTER
2.       F – ENTER è FILEAID
3.       3 – ENTER è UTILITIES
4.       3—ENTER è COPY
5.       YOU WILL GET THIS SCREEN

                Specify "FROM" Dataset Information:                                                     
               Dataset name        ===>       'AATCPS.NM.XSCM7364.OSCC(0)'        è GDG/FILE èFROM WHICH U WANT TO COPY(MAIN FILE/SOURCE FILE)                   
                   Volume serial    ===>                                     (If not cataloged)                
                                                                                                                               
                Specify "TO" Dataset Information:                                                              
                   Dataset name   ===>       'B05GSA.INFILE3'       è FILE WHERE U WANT TO COPY                                
                   Volume serial    ===>                                     (If not cataloged)                
                  Disposition          ===>       NEW              (OLD, MOD, NEW)    èIT WILL CREATE NEW FILE     (NEW FILE)          
                                                                                                                               
                                                                                                               
                Specify Execution Information:                                                
                   Process online or batch                    ===>       O                    (O = Online; B = Batch)           
                                            O è BATCH B è SUBMITTING JCL                                                  
                Specify Selection Criteria Information:              (E = Existing; T = Temporary;     
                   Selection criteria usage   ===>       T     M = Modify; Q = Quick; N = None)  èTEMPORARAY
                   Selection dataset name                   ===>                                                   
                   Member name                  ===>                       (Blank or pattern for member list)

6.       THEN IF U WANT THE MEMORY SPACE TO MORE , THEN CHANGE THAT MSPACE- ENTER
7.       PUT 1 è OPTION – ENTER
8.       SET FOR RECORDS (HOW MUCH REC’S U WANT, HOW MUCH RECS U WANT TO SKIP ETC)

File-AID --------------  Selection Criteria Options  --------------------------
                COMMAND ===>                                                                                 
                                                                                
                Specify Selection Criteria Options:                                           
                                                 Start at the following record key 
                                                 (both blank for start of dataset)       
                  Starting record key            ===>                                                          
                     - OR -                                                 OR         at the following RBA or RRN    
                  Starting RBA or RRN                       ===>                                                                  
                                                                               
                  Initial records to skip        ===>       40           then        skip this many records       
                                                                                
                Subsequent Selection Interval:                          then       repeat the following         
                    Records to select              ===>       20             - select this many records        
                    Records to skip                ===>       0                - then skip this many records     
                                                                 until                                    
                  Number of records to search           ===>       ALL          you have read this many records   
                  Number of records to select             ===>       20             or          selected this many records     
                                                                               
                SEQ/VSAM processing direction      ===>       F                    (F = Forward; B = Backward)        
                                                                                               
                                                                               
   Use      ENTER to return to selection criteria menu

9.       ENTER TO COPY A FILE .
10.    PRESS F3 TO VIEW IS FILE IS COPIED.

Saturday, February 25, 2012

TSO/ISPF File-aid commands

  • UP <n> [ scroll up]
  • DOWN <n> [ scroll down]
  • RIGHT <n> [ scroll right]
  • LEFT <n> [ scroll left]
  • FORWARD [ bottom of the file]
  • BACK [ top of the file]
  • LOCATE <line num>/<field name>
  • HEX [ causes the data to be displayed in hex values]
  • VFMT [ goes to VFMT mode from current one]
  • FMT [ goes to FMT mode from current one]
  • CHAR [ goes to char mode from current one]
  • SPLIT [ splits the screen]
  • SWAP [ swaps between the screen]
  • FIND ALL NY [ Find all records having characters ‘NY’]
  • EX ALL “NY” <col number> [ Exclude the records having character ‘NY’]
  • RFIND [ repeat previous find command]
  • FLIP [ toggling of EX command]
  • DISPLAY <field-num>-<field num>/ALL ON/OFF/ONLY
  • SHOW PICTURE/OFFSET/FORMAT/LEVEL[FMT]/NUMBER[FMT]
  • ZERO [ON/OFF]

Monday, February 20, 2012

COBOL FAQS-5

Q.    Can the number of operands in the USING phrase in called program be different than the number of operands in the USING statement of calling programs?
A         The number of operands in the calling program USING phrase and the called program USING phrase must be identical.

Q.    How do file operands of the calling program USING phrase align with the operands of the called program USING phrase?
A         The correspondence is by position - not by name.

Q.    Can a called program contain CALL statements?
A:        Yes. However, a called program may not CALL the calling program directly or indirectly.

Q.    What is a COPY statement?
A         The COPY statement copies existing text from a copy library into a COBOL program. For example :
COPY text - name.

Q.    What is a copy library?
A.        A copy library is basically a COBOL source library containing members that can be, copied into COBOL source programs.



Q.    What type of text can be copied using the COPY statement?
A.        The type of text that can be copied into a COBOL program includes all types of components of a COBOL program, including file definitions, working storage and procedure division code.

Q.    What is the REPLACING option of a COPY statement?
A         The REPLACING option of a COPY statement contains two operands and performs the COPY, replacing all occurrences of the first operand within the copied library member text by the second operand.

Q.    Can the text of a copy library member contain nested COPY statements?
A         In COBOL II a copy library member may contain nested COPY statements. This is not the case in VS-COBOL.

Q.    Can a copy member with nested COPY statements contain the REPLACING option?
A         No, a nested COPY statement cannot contain the REPLACING option.

Q.    Can a COPY statement with the REPLACING option contain nested COPY statements?
A         No, a COPY statement with the REPLACING option cannot contain nested COPY statements.

Q.    What are some advantages to using COPY statements?
A         An installation can develop standard file descriptions and mandate their use for standardization and ease of testing and maintenance. Also, standard working storage descriptions, record descriptions and procedure division code can be developed, enhancing development and maintenance efforts.

Q.    What is the BY CONTENT phrase in COBOL II?
A         The BY CONTENT phrase permits constants to be passed to a called program by using the CALL statement.

Q.    What is the BY CONTENT LENGTH phrase in COBOL II?
A:        The BY CONTENT LENGTH phrase permits the length of a data item to be passed to a called program by using the CALL statement.

Q.    What is the PICTURE clause?
A         The PICTURE clause defines an elementary items basic characteristics and editing requirements.

Q.    What would be the result of moving 030193 to a PICTURE clause of PICTURE 99/99/99?
A         The result would be 03/01/93 - but only if the month, day and year were moved separately.

Q.    How are numbers stored in the computer?
A:        Each digit is stored in a single byte; the first 4 bits contain the “zone”. The last 4 bits contain the digit. For numbers the zone indicates positive numbers (a C or an F) and negative numbers (D).

Q.    What is EBCDIC?
A:        EBCDIC is an acronym for Extended Binary Coded Decimal Interchange Code.

Q.    In EBCDIC, how would the number 1234 be stored?
A         The number 1234 would be stored as : Fl F2 F3 F4.

Q.    What is packed decimal?
A.        It is a method of storing numbers in less space. The zone is eliminated from each of the digits except for the last digit which contains sign for number. Packed decimals are always stored in an even number of bytes and the last byte is always the sign.  The number of bytes used is determined by adding 1 to the total bytes requested and dividing by 2. The answer is always an even number.

Q.    How would the number +1234 be stored if a PIC clause of PICTURE S9(4) COMP-3 were used?
A         The answer will use 3 bytes (4 + 1 = 5 / 2 = 2.5 or 3), so a leading 0 will pad the answer : 01234F.

Q.    What are binary numbers?
A         Binary numbers are strings of 0s and 1s which are stored in half word, full word, or double word, depending on the size of the number.
·                     Up to 4 digits are stored in 2 bytes or a half word.
·                     5-9 digits are stored in 4 bytes or a word.
·                     10-18 digits are stored in 8bytes or a double word.

Q.    What is a common problem when doing a table lookup?
A         The maximum occurrences of the table are exceeded as a result of exiting perform based on testing the subscript for "equal to" the maximum number of occurrences rather than "greater than" the number of occurrences. By manipulating subscript, the subscript can become greater than the maximum number of occurrences, permitting the perform to continue beyond bounds of the table.

Q.    What will be the result of executing a VS-COBOL II program when a subscript exceeds the table limits?
A         The table data overwrites program code and will continue to do so until there is an abend. The abend message will reference gibberish code rather than a subscript out of range.

Q.    What will be the result of executing a VS-COBOL II program that was compiled with the SSRANGE option, when a subscript exceeds the table limits?
A         The program will terminate.

Q.    What is a common problem associated with reading a datafile in a test environment?
A         A read is executed on a file that has not been opened by the program.

Q.    What problem could occur when a file is read with an incorrect file definition?
A         A data exception could occur causing the program to terminate.

Q.    In a production environment, what should be programmed when an abnormal condition is encountered and it is undesirable to continue processing?
A         The program should go to a programmed abnormal exit and pass a condition code to the job control language via. an installation standard abend procedure. The job control language should in turn test the condition code and force the job to terminate with an abnormal condition code.

Sunday, February 19, 2012

FRJOB

FRJOB  display does not include any dates or times for elements in the structure.  This is because the flow is being generated backwards through logical control paths.  Also, the display may include jobs with a schedule ID of zero (000) which indicates it represents any occurrence of the job rather than a specific occurrence of the job.  Once you have determined the origin point(s) for the target job you can use one of the other forecasting commands to retrace a particular control path from the origin point to the target job with dates and times provided.

 FRJOB                                                  DATE 12-02-97                        PAGE 0001
                     REVERSE STRUCTURE FOR CA-7 JOBS                            
  A      B         C                          D        E    F             G                                                                             
HDR  LEV# JOB NAME                 SYSTEM   SID TYPE TRIGGERS /DSNBR  /SCHEDULED   
                  --- AMPA270D............ CABPOST  001                                    
          -001       KMPA275D.......... CMPMER   001 JOB  AMPA270D                      
          -002         KMPA006D........ CMPMER   001 JOB  KMPA275D                      
          -003           KMPA005D...... CMPMER   001 JOB  KMPA006D                      
          -004             KMPA003D.... CMPMER   001 JOB  KMPA005D                      
****    -005            KMPA@CMS.. CMPMER   001 JOB  KMPA003D         :**SCHD**    
                                                                               
SFC1-00 REQUEST COMPLETED AT 12:35:10 ON 97.336     

Item Description

     HDR -  This field will contain asterisks (*) if the  element on that line is considered the origination point.  Otherwise, it will be blank.

     LEV#. - This field will contain the logical level of the element on  that line.  The starting point (target job) is at level zero which is represented by three hyphens (---).  The elements which can trigger  the target job will have a level of negative one (-001).  The elements which can trigger the negative one level will have a level of negative two (-002), and so forth.

     JOBNAME -   This field contains the name of the job or network which triggers an element on the next higher level.  The name is offset to the right for each level up to the sixth level (-006).  This makes it easier to see what level a given element is on. Elements that are  six or more levels deep will all appear starting at the same column as the sixth level.

     SYSTEM NAME -  This field contains the application system name of the job on this line.

     SID (Schedule ID) -   This field contains the schedule ID of the job or  network on this line.  A generic schedule ID of zero (000) may appear in the flow.  Such an entry represents ANY occurrence of the job or network.

      TYPE - This field contains a literal which describes the type of element and trigger the line represents.
      Possible values are:
1      JOB  -  This indicates the element in the Job Name field is a job  which triggers the job in the Triggers field through a job trigger.
2      DSET -  This indicates the element in the Job Name field is a job which updates or creates a data set (DSNBR field) which triggers the job in the Triggers field through a data set  trigger.
3      INWK -  This indicates the element in the Job Name field is an input  network which triggers the job in the Triggers field  through a  network trigger.

    TRIGGERS -   This field contains the name of the job on the next higher level which this element triggers.  For example, the last line of the example above means that job KMPA@CMS (level -005) triggers job KMPA003D on the next higher level (level -004).

    DSNBR -   The DSNBR is only displayed if a data set trigger is involved, otherwise it will be blank.

Saturday, February 18, 2012

COBOL FAQS-4

Q.    What is the dynamic access mode?
A         The dynamic access mode permits reading and writing file records by a specific read or write statement which can be sequential and/or random. The dynamic access mode assumes that a file is indexed.

Q.    What access modes are permitted with sequential organization?
A         The sequential access mode only.




Q.    What access modes are permitted with indexed organization?
A         All three access modes-sequential, random and dynamic-are permitted. In dynamic access mode, the file can be accessed sequentially and/or randomly.

Q.    What access modes are permitted with relative organization?
A         All three access modes-sequential, random and dynamic-are permitted.

Q.    What is a START statement?
A         The START statement is used with an indexed or relative organization file for positioning within the file for subsequent sequential record retrieval. The access key may be qualified to provide a record equal to the key, greater than the key, less than the key, greater than or equal to the key.

Q.    Who t is a subscript?
A         A subscript is a positive integer that represents an occurrence within a table that has been redefined with an occurs clause. A subscript must be defined in working storage and can be manipulated like any numeric variable.

Q.    What is an index for tables?
A         An index references data in a table, but does it differently than a subscript. The index is defined with the table and represents a displacement into the table.

Q.    What are the advantages of indexes?
A         Indexes are more efficient when used with the SEARCH verb because the computer does not have to generate displacement from the beginning of the table.

Q.    What are two SEARCH techniques?
A         The sequential or serial search moves through a table one record at a time until a match has been made. For example, in a table of 10 numbers (1 to 10), to find the number 8, the search must check and eliminate numbers 1 to 7. The process is initiated by verb SEARCH.

The binary is a dichotomizing search and must have a key that is in ascending or descending order. At each step of search, half of the records in the table are eliminated. For example, in SEARCH for the number 8, the first division would locate the number 5 and eliminate records 1 to 5. The second division would locate the number 8. The process is initiated by the very SEARCH ALL.

Q.    What COBOL verbs can change table indexes?
A         SET, SEARCH and PERFORM can change the value of a table index.

Q.    Is a binary search efficient when compared to a sequential search?
A         The binary search is more efficient because it finds the answer with fewer data checks. However the process for each data check is less efficient because of the machine code generated. If the list/table of variables has fewer than 100 entries, a sequential search would be a better choice.

Q.    What is the most efficient method for locating data in a table?
A         If you know the location of the data in the table, use it. For example, in a table of names of months, use numeric value of the month to locate the name. To convert 04/01/93 to April 01 1993, the 04 would be used as the subscript to locate the word April.

Q.    How could one subscript sequentially through a table of 50 states, looking for NY?
A         Given the subscript SUB-1 PIC 99, the following COBOL II code could be used :

PERFORM TABLE - LOOK - UP THRU TABLE - EXIT VARYING SUB 1 FORM 1
BY 1 UNTIL SUB - 1 > 50 OR MATCH - FOUND.

CONTINUE 1. (CONTINUE WITH PROGRAM)

TABLE - LOOK - UP.

IF STATE (SUB - 1) = ‘NY’
SET MATCH - FOUND TO TRUE
MOVE TABLE-DATA (SUB-1) TO OUTPUT DATA
END-IF

TABLE - EXIT. EXIT.

Q.    Recode the foregoing table lookup using an in-line perform.

PERFORM VARYING SUB - 1 FROM 1 BY 1 UNTIL MATCH - FOUND OR SUB - 1 > 50
IF STATE (SUB - 1) = ‘NY’
SET MATCH - FOUND TO TRUE
MOVE TABLE - DATA (SUB - 1) TO OUTPUT - DATA
END - IF.
END - PERFORM.

Q.    Give answer to the previous question using a binary search, given the 01 level table name as 01 TABLE-NAME, the occurs clause indexed by table-index, ascending key is table-item.

SEARCH ALL TABLE - NAME
AT END
MOVE ‘FILE-ITEM NOT FOUND’ TO FILE - ITEM - DESC
WHEN TABLE - ITEM (TABLE  - INDEX) EQUALS FILE - ITEM
MOVE TABLE - ITEM - A (TABLE - ITEM) TO FILE - ITEM - DESC
END - SEARCH.

Q.   Describe a paragraph - naming convention that would assist navigation through a COBOL program?
A         Paragraph names should be descriptive of what is contained within the paragraph and preceded by a sequential number according to their position within the program. For example :

100 - OPEN - FILLS; 500 - READ MASTER etc,

Q.    What is one major advantage of COBOL II when operating in an MVS/XA environment?
A         COBOL II can utilize 31-bit addressing and therefore operate “above the line” (above 17-MB virtual memory restriction) in an MVS/XA environment-an advantage not available in VS-COBOL.

Q.    What is the format of a COBOL internal sort using an input procedure and an output procedure?
A.                    SELECT SORT-FILE
                        SD SORT - FILE
                        SORT RECORD IS SORT - WORk - RFC.

01 SORT - WORK REC.
                                    05 SORT-DATA.
07 DATA - PART - 1   PIC X(10).
07 FIRST - SORT - KEY         PIC X(5).

(continue with record description for fields necessary for sorting and fields to be sent to sort, the entire record need to be sorted unless required by the program)


PROCEDURE DIVISION.
SORT SORT - FILE
ASCENDING KEY FIRST - SORT - KEY
INPUT PROCEDURE SORT - INPUT - PROCEDURE - 0200
OUTPUT PROCEDURE SORT - OUTPUT - PROCEDURE - 0500

SORT - INPUT - PROCEDURE - 0200 SECTION.
SORT - INPUT - READ - SELECT.

fuse the input procedure to read the file to be sorted, select all or portion of data, process the data in any way and move the data to the sort - work - rec for subsequent release to the sort.)

RELEASE SORT - WORK - REC.

SORT - OUTPUT - PROCEDURE - 0500 SECTION.
SORT - OUTPUT - PROCESSING.

(use the output procedure to return and process the sorted records)

RETURN SORT - FILE AT END ...

Q.    What are come advantages of a COBOL internal sort?
A.        The advantages of a COBOL internal sort are :
·                     You can select only the records required by the program, reducing sort resource requirements
·                     Records can be processed before and after the sort
·                     One or more sorts may be performed on the same data for different functions within the program
·                     The program will document the criteria for record selection and sort criteria
·                     Data from separate files can be combined

Q.    Is the SORT utility a responsible alternative to the internal sort?
A.        The sort utility would require an extra step in the JCL and would select, sort and document criteria. It could not manipulate the data before sort. The final decision depends on installation standards.

Q.    What is a bubble sort?
A.        A bubble sort is an efficient way of resequencing a small table that already resides in memory. The sorting algorithm that can be used is referred to as a bubble sort. The bubble sort compares the key of first item in a table with the keys of all other items in the table, each time moving the item with the lowest key to the first item’s position. The process is continued, starting with the second item, comparing it to the third item, swapping pairs of items until the entire table is in order.

Q.    What is an in-line perform?
A         COBOL II allows a performed procedure to be, coded in-line. The perform statements is  coded without a paragraph name, followed directly by the code to be performed. An END - PERFORM statement is required and coded at the end of an in-line perform.
PERFORM
       :
END - PERFORM

Q.    What Is COBOL II statement WITH TEST AFTER?
A         In a PERFORM, the UNTIL clause is examined before the PERFORM, not after.  COBOL II allows programmer to specify PERFORM WITH TEST AFTER, which will always execute a paragraph at least once.

Q.    How could 88 levels be used for validation of data for valid values and valid ranges?
A.        The 88 level is used to specify the valid values and/or rings of values and then the 88 data name is used in an if statement to test the data.

Q.    Give an example of how you would code an “88”.
A         02 INPUT - LOCATION PICTURE 9(3).
88 VALID - LOCATIONS VALUES ARE 100, 200 THRU 299.

Q.    How could 88 levels be used to determine the next step in navigating through a program?
A         The 88-level data name can be used to specify a condition in both if and evaluate statements.
IF VALID - LOCATIONs
PERFORM PARA - A
END - IF

EVALUATE TRUE
WHEN VALID -LOCATIONS
PERFORM PARA - A
WHEN OTHER
PERFORM PARA - B
END-EVALUATE

Q.    What is a CALL statement in COBOL?
A         A CALL is a statement that transfers control from one object program to another object program within the same run-unit..

Q.    What does the COBOL “CANCEL” statement do?
A         The CANCEL statement ensures that next time the referenced sub- program is called it will be entered in its original state.

Q.    What is the LINKAGE SECTION in COBOL?
A         The LINKAGE SECTION of a called program defines the data that is available (from a calling program) to a called program.

Q.    Which program can reference the data items described in the LINKAGE SECTION?
A         The data items in a LINKAGE SECTION may be referenced by the calling program as well as by the called program.

Q.    What is the USING phrase of CALL statement?
A         The USING phrase makes available data items from calling to the called programs.

Q.    When can the USING phrase be included in the CALL statement?
A         The USING phrase can be included in the CALL statement only if there is a USING phrase in the Procedure Division header or the ENTER statement through which the called program is invoked.