Labels

Wednesday 1 January 2014

Functions in REXX

This are also called as Commands or Instructions which instruct the REXX compiler what are all the things to do.

Terminal input and output

Say - 'Say' Command is used to display output to the terminal/user.

Pull - 'Pull' command is used  to recieve input from the terminal/user. user has to Press 'Enter' once the user given the input.

Example:

SAY “ENTER YOUR AGE”
PULL AGE /*What ever the person types is converted
into upper case and stored in AGE */

PARSE PULL AGE /* Same as above, but input is not
converted to Uppercase */

SAY ‘ENTER YOUR FIRST AND LAST NAME ‘

PULL FNAME LNAME /*REXX assumes variables are
delimited by space */


Tip: Suppose if a user want to display the variable name as it is in the terminal then he should write the variable within single quotes.

For Example, consider the below program.

/* REXX */

Say A
A = Hello World
Say A
Say 'A'

Say A Statement in above code behaves differently.

First 'Say A' displays 'A' as 'A' doesn't contain any value.

Second 'Say A' displays as 'Hello World' as 'A' contains 'Hello World'.

Third 'Say 'A'' displays the word 'A'.

No comments:

Post a Comment