Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Intrinsic function

Status
Not open for further replies.

Uvaiz

MIS
Jun 13, 2003
38
CA
Hi,

I am trying to convert the upper-case to lower-case in Cobol400 using the following statement.

example

INITIALIZE WS-USRPWD-IN.
STRING

USER DELIMITED BY ' '
' ' DELIMITED BY SIZE
PASSWORD DELIMITED BY ' '
INTO WS-USRPWD-IN
END-STRING.
MOVE LOWER-CASE(WS-USRPWD-IN) TO WS-USRPWD-IN.

when compiled I see the following message

93 MSGID: LBL1326 SEVERITY: 30 SEQNBR: 009500
Message . . . . : 'LOWER-CASE' not defined name. Default item
assumed.
Can someone explain how to circumvent this problem please. I have looked through the IBM manual on COBOL400 no detailed reference to this function.

Thank you






 
Hi U,

Think what you need is:

MOVE FUNCTION LOWER-CASE....

Jack
 
Thanks

Sorry for the typing error. I did include FUNCTION in my statement which should read as follows

MOVE LOWER-CASE(WS-USRPWD-IN) TO WS-USRPWD-IN.

Does the IBM for ILE COBOL V5R1 that I am currently using anything got to do with this problem.

Thank you in advance
 
COBOL/400 does NOT have intrinsic functions.

Only ILE/COBOL has them. See if your shop can use the ILE insted of the version you are using.

Programs with both can be mixed up so you do not need to recompile everything.
 
What about INSPECT... CONVERTING?

EXAMPLE:

Code:
000100*$CALL
000200 IDENTIFICATION DIVISION.
000300******************************************************************
000400* COPYRIGHT (C)  R.G. WOUTERSON / ADVIESBUREAU WOUTERSON         *
000500******************************************************************
001500 PROGRAM-ID. TEST4.
001600 ENVIRONMENT DIVISION.
001700 CONFIGURATION SECTION.
001800 SOURCE-COMPUTER. RGWOUTERSON.
001900 OBJECT-COMPUTER. RGWOUTERSON.
002000 SPECIAL-NAMES.
002100     CONSOLE IS CONSOLE
002200     DECIMAL-POINT IS COMMA.
002300 INPUT-OUTPUT SECTION.
002400 FILE-CONTROL.
003500 DATA DIVISION.
003600 FILE SECTION.
007200
007300 WORKING-STORAGE SECTION.
007400 01  HULPVELDEN.
007700     03  H-ASCII-LOWERCASE           PIC X(26)  VALUE
007800     'abcdefghijklmnopqrstuvwxyz'.
007900     03  H-ASCII-UPPERCASE           PIC X(26)  VALUE
008000     'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
008100 01  INPUT-TO-CONVERT                PIC X(80).
008300 PROCEDURE DIVISION.
008400 000.
008500    MOVE 'qqwqerwititiotoitoiwiwuurt' TO INPUT-TO-CONVERT.
008510    DISPLAY INPUT-TO-CONVERT.
008600    INSPECT INPUT-TO-CONVERT CONVERTING H-ASCII-LOWERCASE TO
008700                                        H-ASCII-UPPERCASE.
008800    DISPLAY INPUT-TO-CONVERT.
008900    STOP RUN.
 
I like Crox's solution. My current contract is COBOL/400. The client does NOT want code in ILE. So, I don't have any built-in functions to do this. But, to implement this in a modular manner, I created a program that converts upper to lower or lower to upper. It is called:

WORKING-STORAGE SECTION.
01 WORK-FIELDS.
03 STRING-TO-CONVERT PIC X(100) VALUE "mY1pass3WorD".
03 UL-FLAG PIC X VALUE "U".

PROCEDURE DIVISION.

MOVE WS-USRPWD-IN TO STRING-TO-CONVERT.
CALL "CONVERTUL" USING STRING-TO-CONVERT, UL-FLAG.
MOVE STRING-TO-CONVERT TO WS-USRPWD-IN.

STOP RUN.

STRING-TO-CONVERT ends up being "MY1PASS3WORD".
this allow other programs to use it. UL-FLAG can be "U" for converting to upper or "L" for converting to lower.

Tom.

PS: It seems kind of odd to be handling user passwords in clear text.



 
Hi Tom,

Just a minor point. I'm told that using constants instead of variables results in better performance. E.g.:
Code:
    INSPECT INPUT-TO-CONVERT CONVERTING
            'abcd.....zyz'
         TO 'ABCD.....XYZ'
Regards, Jack.
 
Thank you Jack, Tom, Crox for your contributions. My problem has been resolved from your inputs.

Thanks again,
Tony U
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top