systemappsprogram.blogspot.com

AS400 String Functions

The Following are the AS/400 String Scalar Functions

Char(X,F)
Related imageReturns the string-representation of a date, time or timestamp value, X. F is the format, (which is optional), and can be: USA, ISO, JUL or any defined system format.

CHARACTER_LENGTH(X)
Retuns a long integer representing the length of X if X is a character string. Lengths of VARCHAR is the actual length of the string, not the max length of the Varchar. The length includes any trailing blanks.

CONCAT(X,Y)
Returtns a string that is the result of concatinating X||Y

Example: Select concat(FirstName,LastName) from Emp

LEFT(S,L)
Returns the leftmost L characters from string S. IF L is bigger than S, S is padded with blanks.

LENGTH(X)
Returns the length of X.
C*                                                                   
C     KYDETL        KLIST                                           
C                   KFLD                    PERIOD            4 0   
C                   KFLD                    S1VEND                   
C*                                                                   
C                   EVAL      TOTSEC = *ZEROS                       
C                   EVAL      TOTSEC1 = *ZEROS                       
C*                                                                   
C                   MOVE      'INZ01 '      STEP              6     
C                   ENDSR
LTRIM(X)
Left trims the string X, (removes beginning blanks).

RTRIM(X)
Trims trailing blanks from string X.

STRIP(S,Dir,Chr)
Strings character Chr from string S in direction Dir. Valid directions are Both, Leading or Trailing.

SUBSTR(S,Str,Len) or SUBSTRING(S,Str,Len)
Returns a substring beginning at position Str and continuing to Len from string S.

TRANSLATE(X,C1,C2)
Replaces occurrences of C1 with C2 in string X.

TRIM(X)
Removes leading and trailing blanks from string X.

UCASE(X) or UPPER(X)
Returns X as an all caps string.

VARCHAR(X,L)
Returns X as a varchar string of max imum length L.

VARGRAPHIC(X,L)
Returns X as a vargraphic of max length L
Share:

No comments:

Translate

Popular Posts

Recent Posts

Support System Software

Customer support is usually one of the key aspects for all companies, both small and large enterprises. Having a reliable customer support system will result in a positive image of your brand and will be a clear sing that you actually care about your clients and put effort into keeping them satisfied. Our team of SaaS experts have collected and tested all popular customer support software services currently available in the market. Our list should allow you to more easily decide which solution will work best for your business. Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.