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!

How do I trim spaces of a vaiable 2

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
GB
I have a varible WS77-LABEL1 PX (15) RIGHT JUSTIFIED.
This variable value is stored in a seperate file. This files is used for storing strings upto 30 characters long. The value stored in the file for this particular variable is "ROW". However as it is right justified it is showing blanks as it is picking up "ROW " from the file. When I pick up this value can I trim the spaces? If so how?
 
bebbo,
There are about a zillion different COBOLs that we use, and I'm sorry if this does not apply to yours...

However, at least if you're using Microfocus (Workbench or Net Express)--I'm not sure about other implementations of COBOL, you can remove the trailing spaces from your records by saying in FILE-CONTROL:

SELECT blah, blah
ASSIGN to blah, blah
ORGANIZATION IS LINE SEQUENTIAL.

When you write the records, the trailing spaces will be replaced by <CRLF>, just as if you were doing a save from a text editor.

Hope this helps,
Tranman
 
In the description you say the variable is right justified, but the example is left justified. Please clearify.
 
It is a common misconception that JUSTIFIED (or JUST) causes the data in the field to be right justified. It does not. What it does do is affect how characters are handled when this field is a receiving field:

&quot;When the JUSTIFIED clause is specified for a receiving item, the data is aligned at the rightmost character position in the receiving item. Also:

1. If the sending item is larger than the receiving item, the leftmost characters are cut off.

2. If the sending item is smaller than the receiving item, the unused character positions at the left are filled with spaces.
...
The JUSTIFIED clause does not affect initial settings, as determined by the VALUE clause.&quot;

Most COBOL data items are fixed length, so JUSTIFIED has little real use. Using reference modification on the sending field is the most likely way to find a use for this feature and appropriate use of reference modification on the receiving end can usually eliminate the JUSTIFIED clause altogether. Given the confusion JUSTIFIED can cause, I think not using it is a &quot;good thing&quot;.

Regards.

Glenn
 
Can't agree with you more Glenn. I rate it right under CICS's BIF DEEDIT. They're virtually unuseable.

Regards, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top