Wednesday, 31 August 2016

How to check whether a file is empty using JCL?

We can check whether a file is empty using the below methods,

USING IDCAMS

//STEP01 EXEC PGM=IDCAMS                          
//SYSPRINT DD  SYSOUT=*                            
//SYSOUT   DD  SYSOUT=*                            
//DDIN     DD  DSN=&TEST.DATA.FILE,DISP=SHR
//SYSIN    DD*
    PRINT INFILE(DDIN) COUNT(1) CHAR
/*    


IF RETURN CODE IS EQUAL TO 4 THE FILE IS EMPTY


USING SELCOPY

//STEP01 EXEC PGM=SELCOPY                          
//SYSPRINT DD  SYSOUT=*                            
//SYSOUT   DD  SYSOUT=*                            
//DDIN     DD  DSN=&TEST.DATA.FILE,DISP=SHR
//DDOUT    DD  DUMMY
//SYSIN    DD*
     READ DDIN
     WRITE DDOUT
/*    

IF THE RETURN CODE IS = 16 THEN THE FILE IS EMPY

USING ICETOOL

//STEP01 EXEC PGM=ICETOOL                          
//TOOLMSG  DD  SYSOUT=*                            
//DFSMSG   DD  SYSOUT=*                            
//DDIN     DD  DSN=&TEST.DATA.FILE,DISP=SHR
//TOOLIN   DD  DATA
     COUNT FROM(DDIN) EMPTY
/*    

IF THE RETURN CODE IS = 0 THEN THE FILE IS NOT EMPY ELSE EMPTY


USING IKJEFT01

//STEP01  EXEC PGM=IKJEFT01,DYNAMNBR=25

COUNTS THE NUMBER OF RECORDS IN THE FEED FILE

IF RETURN CODE IS LESS THEN 4 THE FILE IS EMPTY ELSE THE FILE HAS DATA.

COND in JCL

COND=(0,EQ) OR COND=(0,EQ,STEP01) OR COND=ONLY OR COND=EVEN

0             = RETURN CODE 
EQ         = LOGICAL OPERATOR (WE CAN GIVE CONDITIONS LIKE (GT - GREATER THEN,                  LT - LESSER THEN, GE - GREATER THEN OR EQUAL TO, LE - LESSER THEN OR                  EQUAL TO, EQ - EQUAL TO, NE - NOT EQUAL TO)
STEP01 = STEP NAME WHICH RETURN CODE HAS TO BE CONSIDERED.


EQUAL TO & NOT EQUAL TO

Eg:
//STEP01  EXCE  PGM=IKJEFT01
//
//STEP02  EXEC  PGM=IDCAMS,     
//              COND=(0,EQ,STEP01)


HERE THE STEP02 WILL BE BY PASSED IF THE STEP01 ENDS WITH RETURN CODE 0
IF THE CONDITION IS TRUE THEN THE STEP WILL GET BY PASSED IF THE CONDITION IS FALSE THEN THE STEP WILL GET EXECUTED.

Eg:
//STEP01  EXEC  PGM=IKJEFT01
//
//STEP02  EXEC  PGM=IDCAMS,     
//              COND=(0,NE,STEP01) 

HERE THE STEP02 WILL GET EXECUTED IF THE STEP01 ENDS WITH RETURN CODE > 0

LESS THEN & GREATER THEN

Eg:
//STEP01  EXEC  PGM=IKJEFT01
//
//STEP02  EXEC  PGM=IDCAMS,     
//              COND=(04,LT,STEP01)


HERE THE STEP02 WILL BE BY PASSED IF THE STEP01 ENDS WITH RETURN CODE 0
IF THE CONDITION IS TRUE THEN THE STEP WILL GET BY PASSED IF THE CONDITION IS FALSE THEN THE STEP WILL GET EXECUTED.

Eg:
//STEP01  EXEC  PGM=IKJEFT01
//
//STEP02  EXEC  PGM=IDCAMS,     
//              COND=(0,GT,STEP01) 

HERE THE STEP02 WILL GET EXECUTED IF THE STEP01 ENDS WITH RETURN CODE < 0

EVEN & ONLY
Eg:
//STEP01  EXEC  PGM=IKJEFT01
//
//STEP02  EXEC  PGM=IDCAMS,     
//              COND=EVEN 

HERE THE STEP02 WILL GET EXECUTED EVEN IF THE PREVIOUS STEP ABENDS OR SUCCESSFUL

Eg:
//STEP01  EXEC  PGM=IKJEFT01
//
//STEP02  EXEC  PGM=IDCAMS,    
//              COND=ONLY 

HERE THE STEP02 WILL GET EXECUTED ONLY IF THE PREVIOUS STEPS ABENDS

Tuesday, 30 August 2016

Overriding only one dataset in 3 concatenated datasets

Mention the override step with specific DD names with spaces for which we are not going to specify with any overrides from JCL.

For eg:

//STEP1.PRC   DD DSN=
//DDF1              DD DSN=MLOGI.DATA.FILE2,DISP=SHR
//DDF2              DD DSN=

Do not specify DD names with DUMMY as the datasets will be considered as DUMMY.

For eg:

//STEP1.PRC   DD DUMMY
//DDF1              DD DSN=MLOGI.DATA.FILE2,DISP=SHR
//DDF2              DD DUMMY

Thursday, 5 June 2014

Modify existing field using sort

To modify a field when it matches the condition given in Sort:

//SYSIN DD *
      SORT FIELDS=COPY
      OUTREC IFTHEN=(WHEN=(7,6,CH,EQ,C'MAHESH'),OVERLAY=(80:C'POLICE MAN')))
/*

the above example is to overlay a particular field in a file using condition.

Here if 7 - position 6 - length CH - character EQ - equal to C - character  (Mahesh)  then
Over write at 80 - position C - character (police man)

Eg:

Hai I Mahesh and I am from Bangalore and my occupation is
Hai l Kumar and I am from sangagiri and my occupation is

Consider the above two lines are there in the OUTREC (output file)
When you use the sort the the output will be as below

Output
Hai I Mahesh and I am from Bangalore and my occupation is Police man
Hai l Kumar and I am from sangagiri and my occupation is

Sort to pull out unpaired fields

Using sort comparing two files and pulling out the unpaired:
//SYSIN DD *
       JOINKEYS FILE=F1,FIELDS=(1,6,A)
       JOINKEYS FILE=F2,FIELDS=(1,6,A)
       JOIN UNPAIRED,F1,ONLY
       SORT FIELDS=COPY
/*
here the F1&F2 represents file one and file two these two files are compared and the un-matching fields are taken out separately.
The fields 1 - represents initial position of the key, 2 - represents length of the key and A- represents the type of character.
Unpaired keys from file one will be taken out and put into separate file.
File - F1
A00001
B00001
C00001
D00001
File - F2
A00001
C00001
Output
B00001
D00001
       

Tuesday, 14 January 2014

Audit Failture in Changeman return code:12

Return code: 12             SYNCH4

Please try to compile the program, once you have made any changes for the copybook inside the same Package.

For example:  Package ID: PAG200014

inside the package there is a cobol program: COB123
also there is a copybook:  CPY123

if you have made any changes to the copybook, then try to audit the package the it will abend showing return code: 12

So please try to compile the program then Audit the package to solve the error.

Sunday, 5 January 2014

Future Mobile technologies

Connecting Mobile(Android, Linux, Windows) with Mainframe.

Mobile Phone - Contains only communicator and additional hardware like Camera, Tracker etc. The Input and the Output will be given through this device.

Cloud - Contains source limiter and storage for every mobile device that gets connected with it.

Mainframe - has all the source for the devices that going to interact with it. For eg: the Operating System will be in the Mainframe and also the processing will happen in Mainframe for every Input or request from the user.

Expense Handler Application with advance technologies

Budget Planner  One of the application developed with Ionic 4 and Python-Flask.  Ionic 4 code:  https://github.com/logeshbuiltin/Expense...