You are on page 1of 7

Work with CL

Day 25
CL Programming:
Overview:
This module enables the student to understand the concept of Control Language.

Outline:
Topics covered,
a. Built -in functions
b. perators in CL
Objective:
By the end of this module, the student should be able to!
a. C"T, BC"T, TC"T, ##T
b. "rithmetic operators, Logical operators and relational operators
$ Du%e#tar Technologies &vt. Ltd.
'()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Work with CL
Day 25
Built In Functions:
With the help of operators an functions ! CL also provies programmers the
abilit" to manipulate string variables an constants#
$C%&: The *C"T operator concatenates t+o strings, +ith the resulting string
containing the complete contents of both strings
$BC%&! The *BC"T operator concatenates t+o strings, placing a space bet+een
t+o strings.
,f -irst string has trailing spaces then *BC"T +ill truncate all training spaces and
add one space bet+een t+o strings.
$&C%&: The *TC"T operator concatenates t+o strings and trims the trailing blan%s
from the .rst string, +ith no space bet+een the strings#
'((&: This built in function e/tracts a #ubstring from a character variable. This
function may also be abbreviated as 0 ##T. The synta/ for this function is! 0##T
1Char2var, start2pos length3 +here char2var is the character variable from +hich
the #ubstring +ill be e/tracted, start2pos is the starting position in the character
to begin the e/traction, and length is the number of characters to be e/tracted.
The result of a 0##T operation may be placed into a di4erent character variable.
-ollo+ing e/ample sho+s the di4erence bet+een *C"T, *BC"T, *TC"T
#tep '! *C"T e/ample,
,n this step +e use 5)CL* an +,&-(.(-%L* to declare variable and system value
respectively.
Columns . . . : 1 71 Edit PB01U01S/MYCLP
SEU==> C1
FMT ** ...+... 1 ...+... ...+... ! ...+... " ...+... # ...+... $ ...+... 7
*************** B%&innin& o' d(t( *************************************
0000.01 /* P)*+),M : E-,MPLE *F *C,T.*BC,T.*TC,T*/
0001.00 P+M
0001.01 /* /ECL,)E T0E 1E)2,BLE 3/T3 ,S +21E4 BEL*5 */
000.00 /CL
3333333
****************** End o' d(t( ****************************************











F!=E6it F"=P7om8t F#=)%'7%s9 F:=)%t7i%;% F10=Cu7so7 F11=To&&l%
F1$=)%8%(t 'ind F17=)%8%(t <9(n&% F"=Mo7% =%>s

&ress -6 and .ll the attributes li%e 7ariable name, type, length.
$ Du%e#tar Technologies &vt. Ltd.
2()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
&ress
Work with CL
Day 25
/%<l(7% CL 1(7i(?l% @/CLA

T>8% <9oi<%s. 87%ss Ent%7.

L(?%l . . . . . . . . . . . . .
CL ;(7i(?l% n(m% . . . . . . . . > &DT 1(7i(?l% n(m%
T>8% . . . . . . . . . . . . . . > *CHAR */EC. *C0,). *L+L
L%n&t9 o' ;(7i(?l%:
L%n&t9 . . . . . . . . . . . . > 6 4um?%7
/%<im(l 8ositions . . . . . . 4um?%7
2niti(l ;(lu% . . . . . . . . .





...



Mo7%...
F!=E6it F"=P7om8t F#=)%'7%s9 F1=C(n<%l F1!=0oB to us% t9is dis8l(>
F"=Mo7% =%>s

8it enter,
Columns . . . : 1 71 Edit PB01U01S/MYCLP
SEU==> C1
FMT ** ...+... 1 ...+... ...+... ! ...+... " ...+... # ...+... $ ...+... 7
*************** B%&innin& o' d(t( *************************************
0000.01 /* P)*+),M : E-,MPLE *F *C,T.*BC,T.*TC,T*/
0001.00 P+M
0001.01 /* /ECL,)E T0E 1E)2,BLE 3/T3 ,S +21E4 BEL*5 */
000.00 /CL 1,)@C/TA TYPE@*C0,)A LE4@$A
000!.00 /* )ET)21E SYSTEM 1,LUE */
000".00 )T1SYS1,L
3333333
****************** End o' d(t( ****************************************









F!=E6it F"=P7om8t F#=)%'7%s9 F:=)%t7i%;% F10=Cu7so7 F11=To&&l%
F1$=)%8%(t 'ind F17=)%8%(t <9(n&% F"=Mo7% =%>s

&9:## -6 and .ll parameter li%e system value and CL variable for returned value 1i.e. +e
are moving the system value /)%&0 in the variable )& as given belo+.
$ Du%e#tar Technologies &vt. Ltd.
;()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
&9:## -6
Work with CL
Day 25
)%t7i%;% S>st%m 1(lu% @)T1SYS1,LA

T>8% <9oi<%s. 87%ss Ent%7.

L(?%l . . . . . . . . . . . . .
S>st%m ;(lu% . . . . . . . . . . D/,TE D,B4*)MS5. D,C+L1L...
CL ;(7i(?l% 'o7 7%tu7n%d ;(lu% C/T C9(7(<t%7 ;(lu%
Comm%nt . . . . . . . . . . . .












Bottom
F!=E6it F"=P7om8t F#=)%'7%s9 F1=C(n<%l F1!=0oB to us% t9is dis8l(>
F"=Mo7% =%>s

8,T :<T:9 and display date using command (1)(,2(3 as sho+n belo+!
Columns . . . : 1 71 Edit PB01U01S/MYCLP
SEU==> C1
FMT ** ...+... 1 ...+... ...+... ! ...+... " ...+... # ...+... $ ...+... 7
*************** B%&innin& o' d(t( *************************************
0000.01 /* P)*+),M : E-,MPLE *F *C,T.*BC,T.*TC,T*/
0001.00 P+M
0001.01 /* /ECL,)E T0E 1E)2,BLE 3/T3 ,S +21E4 BEL*5 */
000.00 /CL 1,)@C/TA TYPE@*C0,)A LE4@$A
000!.00 /* )ET)21E SYSTEM 1,LUE */
000".00 )T1SYS1,L SYS1,L@D/,TEA )T41,)@C/TA
000#.00 /*/2SPL,Y SYSTEM /,TE US24+ *C,T */
000$.00 S4/US)MS+
3333333
****************** End o' d(t( ****************************************







F!=E6it F"=P7om8t F#=)%'7%s9 F:=)%t7i%;% F10=Cu7so7 F11=To&&l%
F1$=)%8%(t 'ind F17=)%8%(t <9(n&% F"=Mo7% =%>s
Eit9%7 MS+ o7 MS+2/ must ?% s8%<i'i%d.
$ Du%e#tar Technologies &vt. Ltd.
6()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
&9:## -6
Work with CL
Day 25
S%nd Us%7 M%ss(&% @S4/US)MS+A

T>8% <9oi<%s. 87%ss Ent%7.

L(?%l . . . . . . . . . . . . .
M%ss(&% t%6t. o7 . . . . . . . . 'TODAYS DATE IS: ' *CAT &DT






M%ss(&% id%nti'i%7 . . . . . . . 4(m%
M%ss(&% 'il% . . . . . . . . . . 4(m%
Li?7(7> . . . . . . . . . . . *L2BL 4(m%. *L2BL. *CU)L2B





Mo7%...
F!=E6it F"=P7om8t F#=)%'7%s9 F10=,ddition(l 8(7(m%t%7s F1=C(n<%l
F1!=0oB to us% t9is dis8l(> F"=Mo7% =%>s

,n message te/t +e add te/t 5Today=s date is= +ith the variable value >DT +hich contain
system value using *C"T %ey+ord. &ress enter-
Columns . . . : 1 71 Edit PB01U01S/MYCLP
SEU==> C1
FMT ** ...+... 1 ...+... ...+... ! ...+... " ...+... # ...+... $ ...+... 7
*************** B%&innin& o' d(t( *************************************
0000.01 /* P)*+),M: E-,MPLE *F *C,T. *BC,T.*TC,T*/
0001.00 P+M
0001.01 /* /ECL,)E T0E 1E)2,BLE 3/T3 ,S +21E4 BEL*5 */
000.00 /CL 1,)@C/TA TYPE@*C0,)A LE4@$A
000!.00 /* )ET)21E SYSTEM 1,LUE */
000".00 )T1SYS1,L SYS1,L@D/,TEA )T41,)@C/TA
000#.00 /*/2SPL,Y SYSTEM /,TE US24+ *C,T */
000$.00 S4/US)MS+ MS+@3T*/,YS /,TE 2S: 3 *C,T C/TA
****************** End o' d(t( ****************************************








F!=E6it F"=P7om8t F#=)%'7%s9 F:=)%t7i%;% F10=Cu7so7 F11=To&&l%
F1$=)%8%(t 'ind F17=)%8%(t <9(n&% F"=Mo7% =%>s

,n above statement +e cat te/t +ith variable value.
Li%e *C"T use *BC"T and *TC"T as given belo+-
$ Du%e#tar Technologies &vt. Ltd.
5()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
-9
Work with CL
Day 25
Columns . . . : 1 71 Edit PB01U01S/MYCLP
SEU==> CLP1
FMT ** ...+... 1 ...+... ...+... ! ...+... " ...+... # ...+... $ ...+... 7
*************** B%&innin& o' d(t( *************************************
0000.01 /* P)*+),M : E-,MPLE *F *C,T.*BC,T.*TC,T*/
0001.00 P+M
0001.01 /* /ECL,)E T0E 1E)2,BLE 3/T3 ,S +21E4 BEL*5 */
000.00 /CL 1,)@C/TA TYPE@*C0,)A LE4@$A
000.01 /*)ET)21E SYSTEM /,TE */
000!.00 )T1SYS1,L SYS1,L@D/,TEA )T41,)@C/TA
000!.01 /*/2SPL,Y SYSTEM /,TE US24+ *C,T */
000".00 S4/US)MS+ MS+@3T*/,YS /,TE 2S : 3 *C,T C/TA
000".01 /*/2SPL,Y SYSTEM /,TE US24+ *BC,T */
000".0 S4/US)MS+ MS+@3T*/,YS /,TE 2S : 3 *BC,T C/TA
000".0! /*/2SPL,Y SYSTEM /,TE US24+ *TC,T */
000".0" S4/US)MS+ MS+@3T*/,YS /,TE 2S : 3 *TC,T C/TA
000#.00 E4/P+M
****************** End o' d(t( ****************************************



F!=E6it F"=P7om8t F#=)%'7%s9 F:=)%t7i%;% F10=Cu7so7 F11=To&&l%
F1$=)%8%(t 'ind F17=)%8%(t <9(n&% F"=Mo7% =%>s
The output of above program is!
/is8l(> P7o&7(m M%ss(&%s

Eo? 0F:F!"/PB01U0"/0BE0 st(7t%d on 0"/0"/0# (t 10:#:# in su?s>st%m D24TE)
TODAYS DATE IS : 040405
*4
TODAYS DATE IS : 040405
*4
TODAYS DATE IS :040405










T>8% 7%8l>. 87%ss Ent%7.
)%8l> . . .


F!=E6it F1=C(n<%l

"bove program sho+s simple output ?6?6?5 is in the format mm, dd and yy +ithout any
separator if you +ant to insert separator use function 0##T
$ Du%e#tar Technologies &vt. Ltd.
@()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
*C"T
*BC"T
*TC"T
Work with CL
Day 25
Columns . . . : 1 71 Edit PB01U01S/MYCLP
SEU==> CLP1
FMT ** ...+... 1 ...+... ...+... ! ...+... " ...+... # ...+... $ ...+... 7
*************** B%&innin& o' d(t( *************************************
0000.01 /* P)*+),M : E-,MPLE *F *C,T.*BC,T.*TC,T*/
0001.00 P+M
0001.01 /* /ECL,)E T0E 1E)2,BLE 3/T3 ,S +21E4 BEL*5 */
000.00 /CL 1,)@C/TA TYPE@*C0,)A LE4@$A
000.01 /*)ET)21E SYSTEM /,TE */
000!.00 )T1SYS1,L SYS1,L@D/,TEA )T41,)@C/TA
000!.01 /*/2SPL,Y SYSTEM /,TE US24+ *C,T */
000".00 S4/US)MS+ MS+@3T*/,YS /,TE 2S : 3 *C,T C/TA
000".01 /*/2SPL,Y SYSTEM /,TE US24+ *BC,T */
000".0 S4/US)MS+ MS+@3T*/,YS /,TE 2S : 3 *BC,T C/TA
000".0! /*/2SPL,Y SYSTEM /,TE US24+ *TC,T */
000".0" S4/US)MS+ MS+@3T*/,YS /,TE 2S : 3 *TC,T C/TA
000".0# /*/2SPL,Y SYSTEM /,TE US24+ GSST */
000#.00 S4/US)MS+ MS+@3T*/,YS /,TE 2S:3 *C,T @GSST@C/T 1 AA +
000$.00 *C,T 3/3 *C,T @GSST@C/T ! AA +
0007.00 *C,T 3/3 *C,T @GSST@C/T # AAA
000F.00 E4/P+M
****************** End o' d(t( ****************************************



F!=E6it F"=P7om8t F#=)%'7%s9 F:=)%t7i%;% F10=Cu7so7 F11=To&&l%
F1$=)%8%(t 'ind F17=)%8%(t <9(n&% F"=Mo7% =%>s
"bove 0##T helps you to sho+ the date including separators. ,n this +ay +e used built
in functions.
$ Du%e#tar Technologies &vt. Ltd.
)()
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.

You might also like