IBM SC34-5764-01 Manual page 78

Cics transaction server for vse/esa
Table of Contents

Advertisement

Using Functions
Other useful built-in functions to test input are WORDS, VERIFY, LENGTH, and SIGN.
Exercise - Writing a program with Built-In Functions
Write a program that checks a file name for a length of 8 characters. If the name is longer than 8
characters, the program truncates it to 8 and sends a message indicating the shortened name. Use the
built-in functions LENGTH, see page 188, and SUBSTR, see page 192.
ANSWER
/***************************** REXX *********************************/
/* This program tests the length of a file name.
/* If the name is longer than 8 characters, the program truncates */
/* extra characters and sends a message indicating the shortened
/* name.
/********************************************************************/
PULL name
IF LENGTH(name) > 8 THEN
DO
name = SUBSTR(name,1,8)
SAY 'The name you specified was too long.'
SAY name 'will be used.'
END
ELSE NOP
Figure 28. Possible Solution
56
CICS TS for VSE/ESA: REXX Guide
/* Gets name from input stream
/* Name is longer than 8 characters
/* Shorten name to first 8 characters */
*/
*/
*/
*/
*/

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rexx

Table of Contents