String handling in REXX program.

String handling in REXX.

In REXX programs, we can handle the string using inbuilt functions

1) LENGTH - It gives the length of given string.
Sample Program -

/*REXX*/
A = 'REXX'
B = LENGTH(A)
SAY 'Length of A is =' B

Console output -
Length of A is =4

2) WORD - It gives the number of words in the given string.
Sample Program -

/*REXX*/

X = 'Use of  String function in REXX'
Y = LENGTH(X)
SAY 'No of words in X are =' Y

Console output -
'No of words in X are =6

Use of switching logic in REXX program.

Use of switching logic in REXX program.

In REXX program, we can add switch logic in order perform respective task.

Sample Program -

/*REXX*/
SAY 'Your Marks'
PULL A
SELECT
  WHEN A < 40
     SAY 'You are FAIL' 
  WHEN A > 40
     SAY 'You are PASS'
  OTHERWISE
     SAY 'Please enter the correct marks'
END

SELECT - It works like SWITCH.

Output Console -
50
You are PASS



How to use loop in REXX program?

How to use loop in REXX program?

In REXX programs, we can add the logic for loops with the help of DO statement.

Sample Program -

Use of IF ELSE statement in REXX.

Use of IF-ELSE statement in REXX.

Lets see how to use the IF-ELSE statement in REXX,

/*REXX*/
A = 10
B = 12
IF A > B THEN
    SAY 'A is greater than B'
ELSE
    SAY 'B is greater than A'

How to execute REXX program in mainframe?

How to execute REXX program in mainframe?

REXX program can be executed by two way,

1) EX command -
Use the command "EX" in front of the member of PDS having REXX program.

2) TSO "<REXX_PROGRAM_NAME>" -
In order to run the REXX program like TSO utility/command,
    i) Add your REXX program member to CLIST dataset
    (In many this library is "<your_id>.A.CLIST")
    ii) Then us the command TSO "<program_name>"


Sample REXX program to add two variables.

Sample REXX program to add two variables.

Lets see how to write a sample program which will do addition of two variables.
In this example input will be given by user dynamically and output (addition) will be displayed on concole.

/*REXX*/
SAY 'Input variable 1='
PULL a

SAY 'Input variable 2='
PULL b
c= a + b
SAY 'Addition is = ' c

PULL - Its like scanf in "C".

Console after program execution -
Input variable 1=
5

Input variable 2=
6
Addition is = 11





REXX

REXX - Restructured Extended Executor.

REXX is a structured, high level programming language and it was designed by "Mike Cowlishaw" (IBM).

Sample REXX Program -

///*REXX*/
//SAY 'Welcome to REXX world!'

SAY - It is used to print the string on console. Its like DISPLAY in cobol.


What is IEFBR14?

What is IEFBR14?

IEFBR14 is a null program. It's purpose is do nothing, just ext a program or a procedure.
It's used for syntax check of JCL since it does nothing.

Use of IEFBR14 -

//MYJOB   JOB  (,,,)
//STEP_1  EXEC PGM=IEFBR14
..
..

How to override a step of cataloged procedure from JCL?

How to override a step of cataloged procedure from JCL?

//MYJOB   JOB  (,,)
.
.
//MYPROC   EXEC  PROC_NAME
.
.
//STEP_NAME.DDNAME

STEP_NAME = Name of a step from given cataloged proc PROC_NAME
DDNAME= DDNAME of given step STEP_NAME.

How to restart a job from particular step in JCL?

How to restart a job from particular step in JCL?

Job can be restarted from particular step using below syntax,
Add below command in job card,

RESTART=STEP_NAME

STEP_NAME = Name of step from where you want to restart the job.

If you are using cataloged procedure in your job then the syntax will be as,

//MYJOB    JOB ("","",""),
//                RESTART=MYPROC.STEP_NAME
.
.
//MYPROC   PROC    PROC_NAME

In above example STEP_NAME is a name of step of a proc PROC_NAME

What is SB37 abend in JCL and how to resole SB37 abend?

SB37 abend in JCL

Whenever there is problem with volume of data set, it gives SB37 abend.
In order to resolve the SB37 abend, increase the size of dataset in JCL and restart the job.

How to browse list a program in mainframe?

How to browse list a program in mainframe?

1) Go to the package of given program
(If its not in package then checkout the program in your package)
2) Use a command BL in front of the required program.
3) Now browse listing will appear for given program.

How to get the values during SOC7 abend?

How to get the values during SOC7 abend?

1) Go to FA (fault analyzer)
2) Browse the respective abend entry.
3) Use the option 2 in order to view the exact location of abend.
4) Here it will ask for Browse List (BL) of programs associated with this abend.
(Give the program names and their browse list)
5) Now it will shoe the exact location of abend and the values during abend.

How to resolve SOC7/S0C7 abends?

How to resolve SOC7/S0C7 abends?

In order to resolve the SOC7 abend we can us the the fault analyzer (FA) as,
1) Go to FA and locate the address for abend.
2) Browse list (BL) the program for which abend occurred.
3) Find the given address in given browse list
(First find the HEXLOC as a refer point  in order to locate the address )
4) We will get the line number associated with the given address.
5) The statement associated with the above line number is the point where SOC7 occurred.
6) This will show the cause of SOC7 with respective variables..

S0C7/SOC7 abend.

S0C7/SOC7 abend.

S0C7 abend occurs due to bad data passed to a program variable.
i.e. non numeric data passes to numeric variable.