Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     WRITING OUT A PACKED FIELD TO A FILE ON LINUX

Read-Only Read-Only Topic
Go
Search
Notify
Tools
WRITING OUT A PACKED FIELD TO A FILE ON LINUX
 Login/Join
 
Member
posted
I have the following code that works fine until the number is negative.

GROSS_TAX_ALPHA/A5 = PCKOUT(GROSS_TAX,5,'A5');

When negative the file immediately truncates/does a CRLF.

The field GROSS_TAX is P13.2
 
Posts: 2 | Registered: May 24, 2012Report This Post
Virtuoso
posted Hide Post
If you SAVE (or HOLD FORMAT ALPHA), you get a character-delimited file: when reading the file, the end of each record is marked by a CR LF, or just CR, depending on the operating system.

Packed format uses the low-end half-byte (quartet?) to indicate the sign: C for positive, D for negative.

For negative values with a low-order zero digit, the packed value thus end with hex 0D, which is CR (carriage return, back in TWX days), and that may be misinterpreted as end-of-record. (See illustration below)

For use within Focus, solution is to use SAVB (or HOLD FORMAT BINARY) to obtain a fixed-length output format; Focus will generate the appropriate filedef.


DEFINE FILE EMPLOYEE
SAL1/P12.2=CURR_SAL;
SAL2/P12.2=-CURR_SAL;
SHORT_SAL1/A5 = PCKOUT(SAL1, 5, 'A5');
SHORT_SAL2/A5 = PCKOUT(SAL2, 5, 'A5');
END

TABLE FILE EMPLOYEE
PRINT
  LAST_NAME
  CURR_SAL
  SAL1
  SHORT_SAL1/U5
  SAL2
  SHORT_SAL2/U5
  HIRE_DATE
END


LAST_NAME   CURR_SAL    SAL1       SHORT_SAL1  SAL2       SHORT_SAL2 HIRE_DATE
STEVENS     $11,000.00  11000.00   000011000C  -11000.00  000011000D 80/06/02
SMITH       $13,200.00  13200.00   000013200C  -13200.00  000013200D 81/07/01
JONES       $18,480.00  18480.00   000018480C  -18480.00  000018480D 82/05/01
SMITH       $9,500.00   9500.00    000009500C  -9500.00   000009500D 82/01/04
BANNING     $29,700.00  29700.00   000029700C  -29700.00  000029700D 82/08/01
IRVING      $26,862.00  26862.00   000026862C  -26862.00  000026862D 82/01/04
ROMANS      $21,120.00  21120.00   000021120C  -21120.00  000021120D 82/07/01
MCCOY       $18,480.00  18480.00   000018480C  -18480.00  000018480D 81/07/01
BLACKWOOD   $21,780.00  21780.00   000021780C  -21780.00  000021780D 82/04/01
MCKNIGHT    $16,100.00  16100.00   000016100C  -16100.00  000016100D 82/02/02
GREENSPAN   $9,000.00   9000.00    000009000C  -9000.00   000009000D 82/04/01
CROSS       $27,062.00  27062.00   000027062C  -27062.00  000027062D 81/11/02

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     WRITING OUT A PACKED FIELD TO A FILE ON LINUX

Copyright © 1996-2020 Information Builders