View previous topic :: View next topic
|
Author |
Message |
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi HMO,
You could try something like this:
Code: |
1 /
******************************************************************
WORKING-STORAGE SECTION.
******************************************************************
******************************************************************
01 WS-WORK-FLDS.
******************************************************************
*===>
05 COMP-INFO PIC X(021) VALUE SPACES.
05 WS-ACCT PIC X(019) VALUE
' 1234567890123'.
***********05 WS-ACCT PIC X(019) VALUE
***************' 12345678901234'.
05 WS-ACCT-9 PIC 9(008) VALUE 0.
1 /
PROCEDURE DIVISION.
******************************************************************
000-MAINLINE.
******************************************************************
*===>
*===>
*===>
*-----------------------------------------------------------------
DISPLAY 'TESTPGM STARTED'
MOVE FUNCTION WHEN-COMPILED TO COMP-INFO
DISPLAY 'TESTPGM COMPILED ON '
COMP-INFO(5:2) '/'
COMP-INFO(7:2) '/'
COMP-INFO(1:4)
' AT '
COMP-INFO(9:2)
':'
COMP-INFO(11:2)
DISPLAY ' '
EVALUATE TRUE ALSO TRUE
WHEN WS-ACCT(5:1) = ' ' ALSO WS-ACCT(6:1) NUMERIC
MOVE WS-ACCT(6:8) TO WS-ACCT-9
DISPLAY 'ACCT-9 >' WS-ACCT-9 '< '
WHEN WS-ACCT(6:1) = ' ' ALSO WS-ACCT(7:1) NUMERIC
MOVE WS-ACCT(7:8) TO WS-ACCT-9
DISPLAY 'ACCT-9 >' WS-ACCT-9 '< '
END-EVALUATE
GOBACK |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
This
Quote: |
The variable ACC-No is a group variable. So I think it will be considered as alphanumeric and will allow spaces. |
does not deal with ensuring the value of the 8 bytes is a valid numeric. I'm not sure why the "group" matters.
Hi Jack (bet i shouldn't yell that at the airport),
Yup, that looks like it will do what is needed - might need a few more cases for inputs with less spaces |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Dick,
I used to work w/a guy named Gene. It was kinda funny when we passed in the hallway. |
|
Back to top |
|
|
krishnakumarramaraj
New User
Joined: 15 Nov 2005 Posts: 15 Location: chennai
|
|
|
|
hello,
sorry for late reply.i didnt understand what u said |
|
Back to top |
|
|
nagasri83
New User
Joined: 20 May 2005 Posts: 15 Location: chennai
|
|
|
|
Why don't you use INSPECT & referrence modification concepts to meet this requirement.
Inspect the variable for leading SPACES and then use RM.
INSPECT ACCT-NO TALLYING CNTR FOR LEADING SPACES.
COMPUTE CNTR = CNTR + 1.
MOVE ACCT-NO(CNTR:8) TO WS-ACCT-NO-8.
Hope this works and provides the solution. |
|
Back to top |
|
|
Help-Me-Out
New User
Joined: 09 Dec 2006 Posts: 56 Location: Pune
|
|
|
|
Thanks Ashwin for solution I think this gonna work in my program. As there will not be any characters in acct field.
Thanks,
Sandeep. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
That may work as long as the value is always 8 positions long and never contains a non-numeric other than leading spaces. If the value is entered externally, ensuring that it is numeric (not just supposed to be) can prevent later abends. |
|
Back to top |
|
|
|