View previous topic :: View next topic |
Author |
Message |
technoo_geek Beginner
Joined: 06 Jun 2003 Posts: 1 Topics: 1
|
Posted: Fri Jun 06, 2003 5:07 am Post subject: COBOL NON PRINTABLE CHARACTERS |
|
|
I want to know any way to get rid of non printable characters ( in COBOL ) which is appearing in a variable string . The string is basically a input from a CICS screen which should be edited in the COBOL program. |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Fri Jun 06, 2003 5:33 am Post subject: |
|
|
As far as I know non printable chars in CICS Screen have EBCDIC value less than spaces so this approach should work
Code: | perform varying var-str-ind from 1 by 1 until var-str-ing > length of var-str
if var-str(var-str-ind:01) < spaces
move spaces to var-str(var-str-ind:01)
end-if
end-perform |
|
|
Back to top |
|
|
RonB Beginner
Joined: 02 Dec 2002 Posts: 93 Topics: 0 Location: Orlando, FL
|
Posted: Fri Jun 06, 2003 10:04 am Post subject: |
|
|
Probably longer to code, but faster to execute, and handles any byte.
Code: |
WORKING-STORAGE SECTION.
01 FROM-TAB.
05 X0 PIC X(16) VALUE X'000102030405060708090A0B0C0D0E0F'.
05 X1 PIC X(16) VALUE X'101112131415161718191A1B1C1D1E1F'.
05 X2 PIC X(16) VALUE X'202122232425262728292A2B2C2D2E2F'.
05 X3 PIC X(16) VALUE X'303132333435363738393A3B3C3D3E3F'.
05 X4 PIC X(16) VALUE X'404142434445464748494A4B4C4D4E4F'.
05 X5 PIC X(16) VALUE X'505152535455565758595A5B5C5D5E5F'.
05 X6 PIC X(16) VALUE X'606162636465666768696A6B6C6D6E6F'.
05 X7 PIC X(16) VALUE X'707172737475767778797A7B7C7D7E7F'.
05 X8 PIC X(16) VALUE X'808182838485868788898A8B8C8D8E8F'.
05 X9 PIC X(16) VALUE X'909192939495969798999A9B9C9D9E9F'.
05 XA PIC X(16) VALUE X'A0A1A2A3A4A5A6A7A8A9AAABACADAEAF'.
05 XB PIC X(16) VALUE X'B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF'.
05 XC PIC X(16) VALUE X'C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF'.
05 XD PIC X(16) VALUE X'D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF'.
05 XE PIC X(16) VALUE X'E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF'.
05 XF PIC X(16) VALUE X'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'.
01 TO-TAB.
05 X0 PIC X(16) VALUE X'40404040404040404040404040404040'.
05 X1 PIC X(16) VALUE X'40404040404040404040404040404040'.
05 X2 PIC X(16) VALUE X'40404040404040404040404040404040'.
05 X3 PIC X(16) VALUE X'40404040404040404040404040404040'.
05 X4 PIC X(16) VALUE X'404040404040404040404A4B4C4D4E4F'.
05 X5 PIC X(16) VALUE X'504040404040404040405A5B5C5D5E5F'.
05 X6 PIC X(16) VALUE X'606140404040404040406A6B6C6D6E6F'.
05 X7 PIC X(16) VALUE X'404040404040404040797A7B7C7D7E7F'.
05 X8 PIC X(16) VALUE X'40818283848586878889404040404040'.
05 X9 PIC X(16) VALUE X'40919293949596979899404040404040'.
05 XA PIC X(16) VALUE X'40A1A2A3A4A5A6A7A8A9404040404040'.
05 XB PIC X(16) VALUE X'40404040404040404040404040404040'.
05 XC PIC X(16) VALUE X'C0C1C2C3C4C5C6C7C8C9404040404040'.
05 XD PIC X(16) VALUE X'D0D1D2D3D4D5D6D7D8D9404040404040'.
05 XE PIC X(16) VALUE X'E040E2E3E4E5E6E7E8E9404040404040'.
05 XF PIC X(16) VALUE X'F0F1F2F3F4F5F6F7F8F9404040404040'.
PROCEDURE DIVISION.
INSPECT CICS-FIELD CONVERTING FROM-TAB TO TO-TAB.
|
Ron _________________ A computer once beat me at chess, but it was no match for me at kick boxing. |
|
Back to top |
|
|
zatlas Beginner
Joined: 17 Dec 2002 Posts: 43 Topics: 4
|
Posted: Thu Jun 12, 2003 12:08 am Post subject: |
|
|
I wonder what is the type (PIC in COBOL lingua) of the input field that thus contain unprintable characters. Isn't it the rightmost character in a field that otherwise should contain only digits but in reality contains a string of digits and then, usually a printable alphabethical character in the range of A-Q, but every now and then an unprintable character? If this is the case, then the unprintable charcter is very significant and should never be eliminated!
Remember, you haven't probably written the CICS program. You should consider it a bugless program unless you could prove otherwise beyond any reasonable doubt. Therefore you should consider any input from that program to be valid unless proven otherwise (again, beyond any reasonable doubt!)
If what I suggest is correct, than you get an EBCDIC signed number and I suggest you perform an heavy RTFM (Read The Fu... err Fine Manual) regarding that type before you eliminate a perfectly correct piece of data.
Please let us know whether my assumption is correct or not!
Thanks
ZA |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Thu Jun 12, 2003 12:27 am Post subject: |
|
|
zatlas,
I guess technoo is trying to read and maybe process a cics screen through a cobol program, probably row by row. In such cases there will be an attribute byte before every field in every CICS screen. So if you just read a screen and try to display it then it will become non displayable unless you make those attribute bytes displayable. I guess technoo won't be interested in value of those attribute bytes. So it is okay to replace them by spaces without worrying about data corruption.
Diba. |
|
Back to top |
|
|
zatlas Beginner
Joined: 17 Dec 2002 Posts: 43 Topics: 4
|
Posted: Thu Jun 12, 2003 8:47 am Post subject: |
|
|
You do not 'read' a CICS screen line by line!
If he interfaces with the CICS program, he should work with the BMS map (or mimic it with some 'structure' in his programming language).
If he gets raw CICS screen info, then the unprintable characters could be much more significant and may not be just eliminated.
However, somehow I do not believe he gets the raw CICS information (based on his own testimony I would doubt he has the technical knowledge in CICS internals to do so.) I also believe he already got the individual variable (he says "non printable characters ( in COBOL ) which is appearing in a variable string") that he understands as variable string. I interpret this to be some PIC X(n) that is originated from some PIC S9(n) with elimination of the leading zeroes. Hence my suggestion.
I maybe wrong and would like to hear from him...
ZA |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Thu Jun 12, 2003 3:52 pm Post subject: |
|
|
It's annoying when someone posts a 2 sentence question that doesn't adequately define their problem because they don't want to devote the time.
Then someone (most times more than one) takes the time to reply with a 20-50 line solution that misses the mark because the originator didn't have enough interest in his problem to adequately define it.
Then we spend days trying to wheedle an adequate definition from the originator.
The only reply to that kind of post should be:
"Please read the welcome page carefully and carefully reconstruct your problem statement and resubmit. Thank You." |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Thu Jun 12, 2003 11:26 pm Post subject: |
|
|
Actually I was doing similar stuff using a third tool which used to supply thes CICS screen as an array of PIC X(80) occuring 24 times, hence the suggestion, and the solution.
But as slade pointed out, there's no point in discussing further as the originator is not participating.
Last edited by Dibakar on Sat Jun 14, 2003 10:04 am; edited 1 time in total |
|
Back to top |
|
|
zatlas Beginner
Joined: 17 Dec 2002 Posts: 43 Topics: 4
|
Posted: Fri Jun 13, 2003 5:13 pm Post subject: |
|
|
ditto
dibakar and slade, I appericiate your opinion
ZA |
|
Back to top |
|
|
|
|