RAILWAY RESERVATION – SCHEME Programming

July 31, 2008

THANKS TO SATYA FOR THE CODE – satish.smart@rediffmail.com

;;—————————————————————————————-
;; Database
;;—————————————————————————————-
;; Data definition :
;; (define-struct train(source destination train-no no-of-seats-ac no-of-seats-nonac))
;; train is a structure: (make-train ‘kolkata ‘chennai 1234 24 89)) where source is a symbol, destination is a symbol, train-no is a number, no-of-seats-ac is a number, no-of seats-nonac is a number.

(define-struct train(source destination train-no no-of-seats-ac no-of-seats-nonac))

;; Data definition :
;;(define-struct passenger-id(name age sex class train-no seat-no))
;; passenger-id is a structure: (make-passenger-id ‘azhar 21 ‘m ‘ac 1234 50)) where name is a symbol, age is a number, sex is a symbol, class is a symbol,train-no is a number ,seat-no is a number.
(define-struct passenger-id(name age sex class train-no seat-no))

(define train1(make-train ‘kolkata ‘chennai 1234 24 89))
(define train2(make-train ‘kolkata ‘chennai 1235 24 89))

;(define passenger1(make-passenger-id ‘azhar 20 ‘m ‘ac 1234 88))
;(define passenger2(make-passenger-id ‘azhar 20 ‘m ‘ac 1234 87))

;train_list is list of structure train.
(define train_list(list train1 train2))

;passenger_list is a list of structure passenger list.
(define passenger_list (list ))
;;—————————————————————————————-

(define Userid “Enter administrator id:: “)
(define Password “Enter password:: “)
;; Data definition :
;; (define-struct administrator(admin_id admin_password))
;;where admin_id is a symbol and admin_password is a symbol
;;(define admin (make-administrator ‘mahesh ‘rahul))
(define-struct administrator(admin_id admin_password))

(define admin_list ‘())
;;Contract: me-user : string -> void
;;Purpose: To display a massage and generate a input box to take input.
;;Example: (me-user “Enter a number: “)
;; Enter a number:
(define (me-user admin)

(display admin)
(read))

;;Contract: me-admin : string -> void
;;Purpose: To display a massage and generate a input box to take input.
;;Example: (me-admin “Enter a number: “)
;; Enter a number:
(define (me-admin me)

(display me)
(read))

;;contract:check-login:symbol symbol => boolean
;;purpose:to input the username and password and check whether the user name and password matches or not
;;example (check-login ‘mahesh ‘rahul)
;;=>1
(define (check-login id password)
(set! admin_list (append (list (make-administrator 1234 ‘rahul)) admin_list))
(if (not(eqv? id (administrator-admin_id (car admin_list)))) 0
(if (not(eqv? password (administrator-admin_password(car admin_list)))) 0
1
)))

(load “database.ss”)
(load “fun.ss”)
(load “adminfunc.ss”)
;;(load “prompt.ss”)
;;(load “supportivefunctions.ss”)

;;****************************************************************************************
;; Main Menu
;;****************************************************************************************
;;Contract: main-menu : void -> void
;;Purpose: To display main menu and taking input for the options.
;;Example: (main-menu)
; ****************************************************************************************
; RESERVATION FOR RAILWAYS
; ****************************************************************************************
; MAIN MENU
; ****************************************************************************************
; 1. Admin Menu
; 2. Customer Menu
; 3. Exit
; Enter your Choice:
;;Definition:

(define (main-menu)
(newline)
(display “——————————-”)
(newline)
(display ” RESERVATION FOR RAILWAY “)
(newline)
(display “$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$”)
(newline)
(display ” MAIN MENU “)
(newline)
(display “——————————-”)
(newline)
(display ” 1. Admin Menu “)
(newline)
(display ” 2. Customer Menu “)
(newline)
(display ” 3. Exit “)
(newline)
(let ([choice (choice-read "Enter your Choice: ")])
(cond
[(number? choice)
(cond
[(= choice 1) (admin-menu)]
[(= choice 2) (customer-menu)]
[(= choice 3) (display "BYE BYE")]
[else (display "Entry is Wrong")(newline)(main-menu)]
)
]
[else (display "Enter a proper option...")(newline)(main-menu)]
)
))

;;****************************************************************************************
;; Admin Menu
;;****************************************************************************************
;;Contract: admin-menu : void -> void
;;Purpose: To display menu for the administrator and take input for it
;;Example: (admin-menu)
; ****************************************************************************************
; RESERVATION FOR RAILWAYS
; ****************************************************************************************
; ADMIN MENU
; ****************************************************************************************
; 1. Add new train
; 2. Remove train
; 3. Show updated
; 4. List of passanger in a train
; 5. exit
; Enter your Choice:
;;Definition:
(define (admin-menu)
(let ([id (me-user Userid)] [ps (me-admin Password)] )
(if (= 1 (check-login id ps))
(begin
(newline)
(display “************************************”)
(newline)
(display ” RESERVATION FOR RAILWAYS “)
(newline)
(display “***************************************”)
(newline)
(display ” ADMIN MENU “)
(newline)
(display “——————————-”)
(newline)
(display ” 1. Add new train “)
(newline)
(display ” 2. Remove train “)
(newline)
(display ” 3. Show Train list “)
(newline)
(display ” 4. Produce passenger list “)
(newline)
(display ” 5. exit “)
(newline))
(begin
(display “Enter a valid ID and password”)
(main-menu))))
(newline)
(let ([choice (choice-read "Enter your Choice: ")])
(cond
[(number? choice)
(cond
[(= choice 1) (add-train-details)]
[(= choice 2) (remove-train)]
[(= choice 3) (show-train-list)]
[(= choice 4) (show-passenger-list)]
[(= choice 5) (main-menu)]
[else (display "Wrong entry")(newline)(admin-menu)]
)
]
[else (display "Enter a proper option...")(newline)(admin-menu)]
)
))

;;****************************************************************************************
;; CUSTOMER MENU
;;****************************************************************************************
;;Contract: custome-menu : void -> void
;;Purpose: To display menu for the customer and taking input for the options.
;;Example: (customer-menu)
; ****************************************************************************************
; RESERVATION FOR RAILWAYS
; ****************************************************************************************
; Customer Menu
; ****************************************************************************************
; 1. Check Train Availability
; 2. Check Seat Availibility
; 3. Reservation
; 4. main menu
; Enter your Choice:
;;Definition:
(define (customer-menu)
(newline)
(display “————————————–”)
(newline)
(display ” RESERVATION FOR RAILWAYS “)
(newline)
(display “————————————–”)
(newline)
(display ” CUSTOMER MENU “)
(newline)
(display “————————————–”)
(newline)
(display ” 1. Check Train Availability “)
(newline)
(display ” 2. Check Seat Availibility “)
(newline)
(display ” 3. Reservation “)
(newline)
(display ” 4. Main menu” )
(newline)
(let ([choice (choice-read "Enter your Choice: ")])
(cond
[(number? choice)
(cond
[(= choice 1) (check-train-availability)]
[(= choice 2) (check-seat-availability)]
[(= choice 3) (reservation)]
[(= choice 4) (main-menu)]
[else (display "Wrong Entry..")(newline)(customer-menu)]
)
]
[else (display "Enter a proper option...")(newline)(customer-menu)]
)
))
;;****************************************************************************************
;; Accepting Input Values
;;****************************************************************************************
;;Contract: choice-read : string -> void
;;Purpose: To display a massage and generate a input box to take input.
;;Example: (choice-read “Enter a number: “)
;; Enter a number:
(define (choice-read msg)
(display msg)
(read))

(main-menu)


iPhone 3g UNLOCKED – HELL YEAH!

July 16, 2008

It’s been only a few days since the release of the new iPhone 3g , to be precise only 5 days and it has been unlocked. Apple must be ruing the fact that they did not change the hardware of the 3g so as to prevent it from getting unlocked so soon.

Here are the links which will provide you more information about the unlock.

http://gizmodo.com/5025249/iphone-3g-unlocked-with-sim-card-adapter

http://www.theiphoneblog.com/2008/07/15/iphone-3g-unlocked/

http://www.amitbhawani.com/blog/unlock-hack-apple-iphone-3g/

There is one hack which fakes the IMSI number and another one(which is not yet publicly available) which will hack it through the boot loader.

Regards to all the people who have worked hard for this.

Hell YEAH!!!!


COBOL CODE – Reading from a Sequential File

July 11, 2008

WRITE A COBOL PROGRAM WHICH READS THE LIBRARY FILE CONTAINING THE FOLLOWING INFORMATION -

NAME OF BOOK    AUTHOR    COST    OTHER INFORMATION
20 CHAR        20 CHAR

NOTE:-

1-THE FILE IS A SEQUENTIAL FILE OF LENGTH 80
2-THE FIELD LENGTHS ARE
BOOK NAME – 20 CHAR
AUTHOR – 20 CHAR
COST – 5 CHAR
OTHER INFO – 35

PROGRAM

IDENTIFICATION DIVISION.
PROGRAM-ID NETCOPY.
AUTHOR ROHIT.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT BOOKFILE ASSIGN TO BOOKDAT.
DATA DIVISION.
FILE SECTION.
FD BOOKFILE RECORD CONTAINS 80 CHARACTERS.
01 BOOKDETAILS.
88 ENDOFBOOKFILE VALUE HIGH-VALUES.
02 BOOKNAME PIC X(20).
02 BOOKAUTHOR PIC X(20).
02 BOOKCOST PIC 9(5).
02 BOOKOTHER PIC X(35).
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
BEGIN.
OPEN INPUT BOOKFILE
READ BOOKFILE
AT END SET ENDOFBOOKFILE TO TRUE
END-READ
PERFORM UNTIL ENDOFBOOKFILE
DISPLAY BOOKNAME SPACE BOOKAUTHOR SPACE
DISPLAY BOOKCOST SPACE BOOKOTHER
READ BOOKFILE
AT END SET ENDOFBOOKFILE TO TRUE
END-READ
END-PERFORM
CLOSE BOOKFILE
STOP RUN.


EXECUTE JCL FOR COBOL + Mainframe

July 11, 2008

000001 //RUNCOB JOB ‘LEM01′,’MAC’,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
000002 //STEP1 EXEC PGM=COBOL <= OBJ PRM NAME
000003 //STEPLIB DD DISP=SHR,DSN=IBMMFS.MAC.LOAD <= LOAD MODULE PDS
000004 //JCLFILE DD DISP=SHR,DSN=IBMMFS.MAC.PSFILE <=COBOL QSAM FILE-ID
000005 //SYSPRINT DD SYSOUT=* <= OUTPUT STREAM ( * = X )
000006 //SYSIN DD * <= INPUT STREAM
000007 25
000008 /*
000009 //


COMPILE AND RUN JCL FOR COBOL

July 11, 2008

****** ***************************** Top of Data **************************************
000001 //COBCOMP JOB ‘IBMMFS’,'MAC’,CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID

000002 //PROCLIB JCLLIB ORDER=IBMMFS.PROC.COBOL   <= CONTAINS IGYWCL
000003 //STEP1 EXEC IGYWCL,
000004 // PARM.COBOL=’LIB,APOST,XREF,MAP,OFFSET’    <= COMPILER OPTIONS
000005 //COBOL.SYSIN DD DISP=SHR,DSN=IBMMFS.MAC.SOURCE(COBOL) <= I\P PGM
000006 //LKED.SYSLIB DD DISP=SHR,DSN=IBMMFS.MAC.COPY(SUBCOB) <= COPYLIB
000007 //LKED.SYSLMOD DD DISP=SHR,DSN=IBMMFS.MAC.LOAD(COBOL) <= O\P PGM
000008 //SYSPRINT DD SYSOUT=*
000009 //
****** **************************** Bottom of Data ************************************


MAINFRAME CODE – JCL

July 7, 2008

//OZA195Z JOB OZA,’ROHIT’,MSGCLASS=A,MSGLEVEL=(1,1),CLASS=A,
copy ps

// NOTIFY=&SYSUID,PRTY=10,TIME=(1,1),REGION=0M
//STEP20 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//*SYSOUT DD SYSOUT=*
//SYSUT1 DD DSN=OZA195.TEST1.DATASET,DISP=SHR
//SYSUT2 DD DSN=OZA195.TEST.COPY.HYD,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(10,10),RLSE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0,DSORG=PS)
//SYSIN DD DUMMY
//

COPY PDS
//OZA195Y JOB OZA,’ROHIT’,MSGCLASS=A,MSGLEVEL=(1,1),CLASS=A,
// NOTIFY=&SYSUID,PRTY=10,TIME=(1,1),REGION=0M
//STEP20 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//*SYSOUT DD SYSOUT=*
//SYSUT1 DD DSN=OZA195.TEST.PDS,DISP=SHR
//SYSUT2 DD DSN=OZA195.TEST.C.PDS,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(1,1,18),RLSE),UNIT=SYSDA,
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0,DSORG=PO)
//SYSIN DD *
COPY INDD=SYSUT1,OUTDD=SYSUT2
/*
//

SORT PS
//OZA195S JOB OZA,OZA,MSGLEVEL=(1,1),TIME=(5,5),
// CLASS=A,MSGCLASS=A,NOTIFY=OZA195
//***************************************************
//*KEEP USERID IN PLACE OF OZAXXX IN JOBNAME OZAXXXRP
//*SAMPLE JCL REPRO/COPY DATA FROM PS TO VSAM
//***************************************************
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=OZA195.TEST1.DATASET,DISP=SHR
//SORTOUT DD DSN=OZA195.TER9.DATASET.NEW2,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// DCB=(LRECL=10,BLKSIZE=8000,RECFM=FB),
// SPACE=(CYL,(10,20),RLSE)
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=NONE
/*

copy ps using IDCAMS
//OZA195Y JOB OZA,’ROHIT’,MSGCLASS=A,MSGLEVEL=(1,1),CLASS=A,
// NOTIFY=&SYSUID,PRTY=10,TIME=(1,1),REGION=0M
//STEP20 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO -
INDATASET(OZA195.SORT.DATASET)-
OUTDATASET(OZA195.SORT.DATASET.COPY)
/*
//


007 – Introduction to JCL – SPECIAL DD STATEMENTS

July 4, 2008

SOURCE – http://www.geocities.com/srcsinc/drona/programming/languages/jcl/jcl.html

SPECIAL DD STATEMENTS

1. DUMMY DSN=NULLFILE

2. Concatenating Data sets

3. Passing data to cobol program using – SYSIN DD *

4. SYSOUT

5. SYSUDUMP

6. SYSADUMP

1. DUMMY or DSN=NULLFILE

Some times we need to testing of program, without using actual datasets. Then we can use DUMMY or DSN=NULLFILE. If we use DUMMY, operating system simulates the presence of a file. When you reading Operating system sends end of file request to program.

Example JCL –>

//MYJOB JOB (W345),’KRISHNA REDDY’

//STEP1 EXEC PGM=COBPROG

//INFILE DD DUMMY

2. CONCATENATING DATA SETS

In JCL , we can concatenate different files by giving their name one after another. All data sets concated must be of the same type. For example, partitioned data sets can be concatenated only with partitioned data sets.

Example JCL –>

//MYJOB JOB (W345),’KRISHNA REDDY’

//STEP1 EXEC PGM=COBPROG

//INFILE DD DSN=TEST.GLOB.FILE1

// DSN=TEST.GLOB.FILE2

// DSN=TEST.GLOB.FILE3

In program , we will read it as an single file. concatination of three files done by operating system.

Maximum of 255 sequential data sets can be concatenated together
Maximum of 16 partitioned data sets can be concatenated together

3. PASS DATA TO COBOL PROGRAM USING – SYSIN DD *

This is the one of the way of passing data to program. There are two syntax’s to pass data.

Syntax1 ->

//MYJOB JOB (W234),’RAMESH’

//STEP1 EXEC PGM=COBPROG

//SYSIN DD * /*

Syntax2 ->

//MYJOB JOB (E345),’KRISHNA REDDY’

//STEP1 EXEC PGM=COBPROG

//SYSIN DD DATA /*

4. SYSOUT

The SYSOUT parameter is used to send the output which is generated during job execution.

Syntax ->

//ddname DD SYSOUT=class

EXAMPLE JCL ->

//MYJOB JOB (R456),’KRISHNA REDDY’

//STEP1 EXEC PGM=COBPROG

//INFILE DD SYSOUT=A

In this example, COBPROG is executed and all generated outputs are directed to class ( here it is letter A)

If * used with SYSOUT (SYSOUT=*) parameter, The class assigned to the MSGCLASS parameter will be used to SYSOUT.

5. SYSUDUMP

SYSUDUMP is used to dump the content of various registers, variables and datasets acccessed at the time of abnormal termination, into a dataset. The dump is in hexadecimal.

Syntax –> //SYSUDUMP DD …..

EXAMPLE JCL –>

//MYJOB JOB (W345),’RAMESH’

//STEP1 EXEC PGM=COBPROG

//SYSUDUMP DD DSN=TEST.PROD.LIB

6. SYSABEND

SYSABEND is used to dump the contents of various registers variables , datasets accessed and The nucleus at the time of abnormal termination. The dump is in hexadecimal.

Syntax –> //SYSABEND DD …..

EXAMPLE JCL –> //MYJOB JOB (WE345),’KRISHNA REDDY’

//STEP1 EXEC PGM=COBPROG


006 – Introduction to JCL – DD Statement

July 4, 2008
SOURCE - http://www.geocities.com/srcsinc/drona/programming/languages/jcl/jcl.html

DD STATEMENT

The DD statement (Data Definition), is used to identify the source of input
and the placement of output information

Syntax  ->  //ddname  DD  < positional / keyword parameters >

            ddname must be unique in the job

            Positional parameters -  *
                                     DATA
                                     DUMMY
                                     DYNAM

            Keyword Parameters   -   DSN
                                     DISP
                                     UNIT
                                     SPACE
                                     DCB
                                     VOLUME   

DSN PARAMETER 

    DSN parameter is used specify the data set name

    Syntax  ->  DSN=dataset name

    Example JCL ->  //MYJOB   JOB   (ER3),'RAMESH R'
                    //STEP1   EXEC  PGM=COBPROG
                    //INFILE  DD    DSN=TEST.GLOB.MYLIB

                    TEST.GLOB.MYLIB will be used in the COBPROG program.

TEMPORARY DATA SETS

    Temporary data set is created during job and deleted at the end of the job.  

    Temporary data set can be coded by using two ampersands followed by name.

    Example JCL  --> //MYJOB   JOB   (E456),'RAMESH'
                     //STEP1   EXEC  PGM=COBPROG
                     //INFILE  DD    DSN=&&TEMP         

    Here TEMP is an temporary dataset will be deleted upon job completion.

DISP PARAMETER

   The DISP parameter is used specify the disposition of dataset which is
   coded on DSN parameter. 

   Syntax   ->      

                  

   Parameter on the DISP statement

         Status                   Normal Disposition           Abnormal Disposition

         NEW                      DELETE                       DELETE
         OLD                      CATLG                        CATLG
         MOD                      UNCATLG                      KEEP
         SHR                      KEEP                         UNCATLG
                                  PASS 

    STATUS  

          NEW  -  Dataset will be created. (file should not exists)
          OLD  -  Dataset should exists.
          MOD  -  Dataset will be created If not exists.
          SHR  -  Dataset can be used by other jobs also

    NORMAL DISPOSITION
    (Happened upon sucessful execution of job step)

          DELETE  -  Dataset should be deleted
          CATLG   -  Dataset will be cataloged
          UNCATLG -  Dataset will be removed from system catalogs
          KEEP    -  Dataset will be retained (This parameter should
                     be used with permanent data sets)
          PASS    -  Dataset is to be passed subsequent job step in
                     the same job

    ABNORMAL DISPOSITION
    (Happened upon unsucessful execution of job step)

          DELETE  -  Dataset should be deleted
          CATLG   -  Dataset will be cataloged
          UNCATLG -  Dataset will be removed from system catalogs
          KEEP    -  Dataset is to be kept

    EXAMPLE JCL -->   //MYJOB   JOB   (E674),'KRISHNA REDDY'
                      //STEP1   EXEC  PGM=COBPROG
                      //INFILE  DD    DSN=TEST.GLOB.TEMP,
                      //              DISP=(NEW,CATLG,DELETE)

    In this example , 

          DISP=(NEW,CATLG,DELETE)

          NEW    - TEST.GLOB.TEMP is not exists, it will be created

          CATLG  - Upon successful execution of job step, data set
                    will be cataloged

          DELETE - If job terminicated abnormally, dataset will be deleted

UNIT PARAMETER

    In IBM Mainframe environment, All devices have an address assigned to
    them at the time they added to the sytem. Devices can be referenced
    using this addresses. UNIT parameter is used to specify thise address.

    Syntax  ->   UNIT=device_address/device_type/device_group_name/TAPE

    EXAMPLE JCL -> //MYJOB  JOB   (R345),'KRISHNA REDDY'
                   //STEP1  EXEC  PGM=COBPROG
                   //INFILE DD    DSN=TEST.GLOB.TEST.LIB,
                   //             UNIT=SYSDA

    In above example, COBPROG is executed, and a file INFILE  which may
    reside on any of the devices  which are grouped under the symbolic name
    SYSDA will be accessed

VOL PARAMETER

    This parameter is used to identify the volume serial number on which
    dataset is reside. The VOL dataset is used with disk and tape datasets.

    Syntax  ->   VOL= volumelabel/data set label  

    Sub parameters used with VOL parameter

        SER     -  Specification of serial number
        REF     -  Referencing VOL specification from a prior step
        PRIVATE -  Allowing access to volume by single user
        RETAIN  -  Inhibiting dismounting of volume until end of job
        SEQ     -  Specification of sequence in which volumes are to be mounted

    EXAMPLE JCL -->  //MYJOB   JOB   (E454),'KRISHNA REDDY'
                     //STEP1   EXEC  PGM=COBPROG
                     //INFILE  DD    DSN=TEST.GLOB.TEMP,
                     //              VOL=SER=(VOL1,VOL2,VOL3)

    In this example the data set called DATA3 resides on 3 volumes whose
    serial numbers are VOL1,VOL2,VOL3. The Operating system will request
    that all volumes be mounted at the same time.

SPACE PARAMETER

     The SPACE parameter is used to allocate space for datasets.
     We can allocate space in Cylinders/Tracks/Blocks

     Syntax  ->  SPACE=(CYL,(primary,secondary,directory),RLSE,CONTIG,MXIG,ROUND)

                 Instead of CYL, We can use TRK or BLK

     Meaning of Sub Parameter 

             TRK       -  Requesting space in track

             CYL       -  Requesting space in cylinders

             PRIMARY   -  Primary storage to be allocated at the time of
                          data set created

             SECONDARY -  Additional storage to be allocated ,
			              If primary storage is not sufficient

             DIRECTORY -  Space for recording of name and location of partitioned
                          data sets

             RLSE      -  Request for release of space previously allocated unused
                          space after completion of job

             CONTIG    -  Request for contiguous space

             MXIG      -  Request for large aread of contiguous space

             ROUND     -  Request for entire cylinder for storage of data set

      EXAMPLE JCL  ->   //MYJOB   JOB   (W345),'KRISHNA REDDY'
                         //STEP1   EXEC  PGM=COBPROG
                         //INFILE  DD    DSN=TEST.GLOB.LIB
                         //              UNIT=4560
                         //              SPACE=(CYL,(30,4))

      In this example, 30 cylinders are requested as primary space and 4
      additional cyliders as secondary space.
Upto 15 extends of secondary space ( in our example it is 4 ) will be alloted , If space is not sufficient.
DCB PARAMETER Records in dataset may contain FIXED length / VARIABLE length. The DCB (Data Control Block) parameter is used to specify record format,record length, block size etc.. Syntax -> //ddname DD DCB=< parameters > Subparameters in DCB RECFM - Specification of record format - F/FB/V/VB/U LRECL - Specification of record length BLKSIZE - Specification of block size BUFNO - Specification of buffers EXAMPLE JCL -> //MYJCL JOB (E3445),'RAMESH' //STEP1 EXEC PROG=COBPROG //INFILE DD DSN=TEST.GLOB.LIB // UNIT=234, // DSN=(LRECL=80, // RECFM=FB, // BLKSIZE=800, // BUFNO=30) In this example, The DCB parameter specifies that this file is to have a logical record length of 80 bytes, it will have a fixed block record format, and the block will 800 (800 is multiple of 80). The BUFNO parameter is set to 30, indicating upto 30 buffers may be utilized in virtual storage for this data set. Default buffers are 5,if you not specified any thing
When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

005 – Introduction to JCL – PARAMETERS IN BOTH STATEMENTS (JOB and EXEC)

July 4, 2008
SOURCE - http://www.geocities.com/srcsinc/drona/programming/languages/jcl/jcl.html

PARAMETERS IN BOTH STATEMENTS (JOB and EXEC)

COND  REGION  TIME 

These parameters can code in both JOB and EXEC statements, When we code
these parameters on both statement, 

JOB - REGION     will override     EXEC - REGION

JOB - COND       will override     EXEC - COND

EXEC - TIME      will overrirde    JOB - TIME

Now let us see details of these parameters

REGION - Specifies the amount of space should be used at the time of
         running a job/step

         Syntax  ->      REGION=< value >K
                              or
                         REGION=< value >M

         Example JCL -> //MYJOB  JOB   (AE32),'RAMESH'
                        //STEP1  EXEC  PGM=COBPROG,
                        //            REGION=67K
All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M
COND - Each step sends an a return code to the system upon completion. This is called condition code. COND parameter is used to control the execution of subsequent job steps, depending on the condition code that is returned for prior step. Return code number between 0 and 4095 Syntax -> COND=(comparsion-code,condition) (If coded on job) COND=(comparsion-code,condition [,stepname] [,EVEN / ONLY]) (If coded on step) condition can be GT,GE,LT,LE,EQ,NE Example JCL -> COND coded on JOB //MYJOB JOB (R475),'KRISHNA REDDY' // COND=(4,GT) //STEP1 EXEC PGM=COBPROG //STEP2 EXEC PGM=COBPROG2 In this example we are specifing that if the number 4 is grater than the return code of STEP1, then STEP2 is to be bypassed. It is elaborated further in the following image COND coded on EXEC statement //MYJOB JOB (U769),'KRISHNA REDDY' //STEP1 EXEC PGM=PROG1 //STEP2 EXEC PGM=COBPROG, // COND=(8,EQ,STEP1) // In this example the COND parameter is used to specify that STEP2 should be by passed if 8 is equal to the return code issued by STEP1. TIME - The time parameter is used to specify the amount of CPU time that a job or job step is permitted to utilize. Syntax -> TIME=minutes OR TIME=([minutes] [,seconds]) minutes can be between 1 and 1439 seconds can be between 1 and 59 Example JCL -> If coded on JOB //MYJOB JOB (E234),'RAMESH KRISHNA',TIME=(20,30) //STEP1 EXEC PGM=COBPROG1 //STEP2 EXEC PGM=COBPROG2 //STEP3 EXEC PGM=COBPROG3 In this example 20 minutes 30 seconds time alloted to job. All steps in this job STEP1 STEP2 STEP3 should complete its task within 20 min. 30 sec. If coded on STEP //MYJOB JOB (R567),'KRISHNA' //STEP1 EXEC PGM=COBPRO // TIME=30 In this example 30 min. time is alloted to STEP1. If STEP1 requires more than 30 min. MYJOB will terminate abnormally. If coded on both STEP AND JOB //SECOND JOB ,'R. KRISHNA',TIME=3 //STEP1 EXEC PGM=C,TIME=2 //STEP2 EXEC PGM=D,TIME=2 In this example, the job is allowed 3 minutes of execution time. Each step is allowed 2 minutes of execution time. Should either step try to execute beyond 2 minutes, the job will terminate beginning with that step. If STEP1 executes in 1.74 minutes and if STEP2 tries to execute beyond 1.26 minutes, the job will be terminated because of the 3-minute time limit specified on the JOB statement.
By coding TIME=1440 or TIME=NOLIMIT, It will give a job or step an unlimited amount of time.
To allow a job or step to use the maximum amount of time, code TIME=MAXIMUM. Coding TIME=MAXIMUM allows the job or step to run for 357912 minutes. (Approx. 248 days)

004 – Introduction to JCL – EXEC Statement

July 4, 2008
Source - http://www.geocities.com/srcsinc/drona/programming/languages/jcl/jcl.chapter4.html

EXEC statement

EXEC statement is used to execute a program/procedure

A maximum of 255 EXEC statement can code in an single job

Syntax  - //stepname EXEC PGM=program-name,keyword parameters

            Positional parameter  -  Program-name

Keyword parameters for EXEC

            PARM  ACCT ADDRSPC DPRTY PERFORM RD

PARM

          PARAM parameter is used to pass information to program

          Syntax  ->  PARM=value

                      Value is a string can be 1 to 100 characters long.

         PASSING PARAMETER USING PARM PARAMETER

         

         PARM-INDICATOR will contain "RAMESH"

         PARM-LENGTH contains length of string.             

Remaining parameters , We wont use much     

ACCT    - accounting information for that step

ADDRSPC - used to indicate to the system that the job step is use either
          virtual or real storage

DPRTY   - used to assign priority to the job step

PERFORM - specifies the rate at which system resources used by job step

RD      - restart definition is used to specify automatic restart of a job
          if it abends
Q. If there is a situation, where we need to code more than 255 steps in a JOB?
A. We need to split jcl into two jcls , at the end of the first jcl check the condition
code and initiate the second jcl.