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     [CLOSED] Print two lines in table

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Print two lines in table
 Login/Join
 
Platinum Member
posted
I want to insert records into a db2 table using a storeprocedure. I create a hold file that has the insert statements (See code).
The problem is that the END (DL3) statement must start on on new line. The question is how can i do that?

Another problem is that attribuut TAB_VLGNUM has to be filled with a piece alphanumeric and a piece numeric like 'VLGNUM' plus a sequence number.
Example :
record1 'VLGNUM0001'
record2 'VLGNUM0002'
etc.


 

-* File insert.fex

-SET &ECHO=ALL;

-DEFAULT &APLNAM  = 'Just_a_Name';
-DEFAULT &USRCDE  = 'XXXX';
-DEFAULT &USRREF  = '-2147482861';

DEFINE FILE CAR
APLNAM/A11     = '&APLNAM';
USRCDE/A5      = '&USRCDE';
USRREF/I11     = &USRREF;
KOMMA/A2       = ', ';
QUOTE/A1       = '''';
TAB_VLGNUM/A6  = 'VLGNUM';
DL1/A57        = 'SQL DB2 CALL STOREPROCEDURE_INSERT (';
DL2/A1         = ')';
DL3/A4         = ' END';
END

TABLE FILE CAR
PRINT
      COUNTRY NOPRINT
      DL1
      QUOTE
      APLNAM
      QUOTE
      KOMMA
      QUOTE
      USRCDE
      QUOTE
      KOMMA
      QUOTE
      USRREF
      QUOTE
      KOMMA
      QUOTE
      TAB_VLGNUM
      QUOTE
      KOMMA
      QUOTE
      COUNTRY
      QUOTE
      DL2
-*	  DL3

WHERE RECORDLIMIT EQ 4
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE PCHOLD AS INS FORMAT ALPHA
END

-*-RUN
-*-INCLUDE INS

This message has been edited. Last edited by: Kerry,
 
Posts: 103 | Registered: March 18, 2008Report This Post
Virtuoso
posted Hide Post
Try these ideas. Use function HEXBYT to create a line feed character and PRINT it before your END statement. Create a numeric counter that increments with each new record. You may need to query your DB2 table to determine the last record counter in order to start with the next number for your new records.

-SET &ECHO=ALL;
-*
-DEFAULT &APLNAM  = 'Just_a_Name';
-DEFAULT &USRCDE  = 'XXXX';
-DEFAULT &USRREF  = '-2147482861';
-*
DEFINE FILE CAR
APLNAM/A11 = '&APLNAM';
USRCDE/A5  = '&USRCDE';
USRREF/I11 = &USRREF;
KOMMA/A2   = ', ';
QUOTE/A1   = '''';
DL1/A57    = 'SQL DB2 CALL STOREPROCEDURE_INSERT (';
DL2/A1     = ')';
DL3/A4     = ' END';
NEWLINE/A1 = HEXBYT(10,'A1');
END
-*
TABLE FILE CAR
 PRINT
      COUNTRY NOPRINT
      DL1
      QUOTE
      APLNAM
      QUOTE
      KOMMA
      QUOTE
      USRCDE
      QUOTE
      KOMMA
      QUOTE
      USRREF
      QUOTE
      KOMMA
      QUOTE
      COMPUTE SEQ_NO/I4      = LAST SEQ_NO + 1 ; NOPRINT
      COMPUTE TAB_VLGNUM/A10 = 'VLGNUM' || EDIT(SEQ_NO);
      QUOTE
      KOMMA
      QUOTE
      COUNTRY
      QUOTE
      DL2
      NEWLINE
      DL3
 WHERE RECORDLIMIT EQ 4
 ON TABLE SET HOLDLIST PRINTONLY
 ON TABLE HOLD AS INS FORMAT ALPHA
END
-*
TABLE FILE INS
 PRINT *
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Expert
posted Hide Post
Keep the SQL call and the END out of the INS file:

-* File insert.fex

-SET &ECHO=ALL;

-DEFAULT &APLNAM  = 'Just_a_Name';
-DEFAULT &USRCDE  = 'XXXX';
-DEFAULT &USRREF  = '-2147482861';

DEFINE FILE CAR
APLNAM/A11     = '&APLNAM';
USRCDE/A5      = '&USRCDE';
USRREF/I11     = &USRREF;
KOMMA/A2       = ', ';
QUOTE/A1       = '''';
TAB_VLGNUM/A6  = 'VLGNUM';
END

TABLE FILE CAR
PRINT
      COUNTRY NOPRINT
      QUOTE
      APLNAM
      QUOTE
      KOMMA
      QUOTE
      USRCDE
      QUOTE
      KOMMA
      QUOTE
      USRREF
      QUOTE
      KOMMA
      QUOTE
      TAB_VLGNUM
      QUOTE
      KOMMA
      QUOTE
      COUNTRY
      QUOTE

WHERE RECORDLIMIT EQ 4
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE PCHOLD AS INS FORMAT ALPHA
END
-RUN

SQL DB2 CALL STOREPROCEDURE_INSERT (
-INCLUDE INS
)
END
-RUN


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Why not use MODIFY, it would be very simple.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Thanks far all the reply.

The ideas from Dan did the trick :
- NEWLINE/A1 = HEXBYT(10,'A1');
- COMPUTE SEQ_NO/I4 = LAST SEQ_NO + 1; NOPRINT
and
- COMPUTE TAB_VLGNUM/A10 = 'VLGNUM' || EDIT(SEQ_NO);

Thanks for that.

Francis because it is a stored procedure you have to call it for every record that is in the holdfile. So you have to repeat 'SQL DB2 CALL STOREPROCEDURE_INSERT (' and ') END' that's why I put it in the holdfile.
But thanks for your reply.

Waz probably is MODIFY a good solution but you must have a license for it that we don't have.
But also thanks for your reply.
 
Posts: 103 | Registered: March 18, 2008Report This Post
Expert
posted Hide Post
You don't need a license for MODIFY, its MAINTAIN that you need a license for.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Okay thanks I will try it out.
 
Posts: 103 | Registered: March 18, 2008Report 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     [CLOSED] Print two lines in table

Copyright © 1996-2020 Information Builders