Skip to main content

I have a problem:

in my program is the following declaration

01  benutzername  pic x(100).

EXEC SQL DECLARE
IBOS2_UniDex.dbo.Clients TABLE
( ClientId uniqueidentifier(36)
NOT NULL
,Startzeit datetime(23) NOT NULL
,PulsZeit datetime(23) NOT NULL
,Rechnername ntext(41823)
,Benutzername ntext(41823)
,AnwendungsId ntext(41823)
) END-EXEC.
*> --------------------------------------------------------------
*> COBOL DECLARATION FOR TABLE Clients
*> --------------------------------------------------------------
01 DCLClients.
03 Clients-ClientId PIC X(36).
03 Clients-Startzeit PIC X(23).
03 Clients-PulsZeit PIC X(23).
03 Clients-Rechnername PIC N(32000)
USAGE NATIONAL.
03 Clients-Benutzername PIC N(32000)
USAGE NATIONAL.
03 Clients-AnwendungsId PIC N(32000)
USAGE NATIONAL.
*> --------------------------------------------------------------
*> COBOL INDICATOR VARIABLES FOR TABLE
*> --------------------------------------------------------------
01 DCLClients-NULL.
03 Clients-Rechnername-NULL PIC S9(04) COMP-5.
03 Clients-Benutzername-NULL PIC S9(04) COMP-5.
03 Clients-AnwendungsId-NULL PIC S9(04) COMP-5.

What is the right way to move Benutzername to Clients-Benutzername.

If i code move benutzername to Clients-Benutzername and insert the row into the table,

Clients-Benutzername is for example  "Thomas" rest filled with space.

 

I have a problem:

in my program is the following declaration

01  benutzername  pic x(100).

EXEC SQL DECLARE
IBOS2_UniDex.dbo.Clients TABLE
( ClientId uniqueidentifier(36)
NOT NULL
,Startzeit datetime(23) NOT NULL
,PulsZeit datetime(23) NOT NULL
,Rechnername ntext(41823)
,Benutzername ntext(41823)
,AnwendungsId ntext(41823)
) END-EXEC.
*> --------------------------------------------------------------
*> COBOL DECLARATION FOR TABLE Clients
*> --------------------------------------------------------------
01 DCLClients.
03 Clients-ClientId PIC X(36).
03 Clients-Startzeit PIC X(23).
03 Clients-PulsZeit PIC X(23).
03 Clients-Rechnername PIC N(32000)
USAGE NATIONAL.
03 Clients-Benutzername PIC N(32000)
USAGE NATIONAL.
03 Clients-AnwendungsId PIC N(32000)
USAGE NATIONAL.
*> --------------------------------------------------------------
*> COBOL INDICATOR VARIABLES FOR TABLE
*> --------------------------------------------------------------
01 DCLClients-NULL.
03 Clients-Rechnername-NULL PIC S9(04) COMP-5.
03 Clients-Benutzername-NULL PIC S9(04) COMP-5.
03 Clients-AnwendungsId-NULL PIC S9(04) COMP-5.

What is the right way to move Benutzername to Clients-Benutzername.

If i code move benutzername to Clients-Benutzername and insert the row into the table,

Clients-Benutzername is for example  "Thomas" rest filled with space.

 

The move is OK but if you wish to suppress the trailing spaces on an ntext column then you should use the RTRIM function on the insert.

EXEC SQL                                

INSERT INTO IBOS2_UniDex.dbo.Clients          

(Benutzername                                

) VALUES                              

   RTRIM (:Clients-Benutzername)  

)                                      

END-EXEC                                

Thanks


I have a problem:

in my program is the following declaration

01  benutzername  pic x(100).

EXEC SQL DECLARE
IBOS2_UniDex.dbo.Clients TABLE
( ClientId uniqueidentifier(36)
NOT NULL
,Startzeit datetime(23) NOT NULL
,PulsZeit datetime(23) NOT NULL
,Rechnername ntext(41823)
,Benutzername ntext(41823)
,AnwendungsId ntext(41823)
) END-EXEC.
*> --------------------------------------------------------------
*> COBOL DECLARATION FOR TABLE Clients
*> --------------------------------------------------------------
01 DCLClients.
03 Clients-ClientId PIC X(36).
03 Clients-Startzeit PIC X(23).
03 Clients-PulsZeit PIC X(23).
03 Clients-Rechnername PIC N(32000)
USAGE NATIONAL.
03 Clients-Benutzername PIC N(32000)
USAGE NATIONAL.
03 Clients-AnwendungsId PIC N(32000)
USAGE NATIONAL.
*> --------------------------------------------------------------
*> COBOL INDICATOR VARIABLES FOR TABLE
*> --------------------------------------------------------------
01 DCLClients-NULL.
03 Clients-Rechnername-NULL PIC S9(04) COMP-5.
03 Clients-Benutzername-NULL PIC S9(04) COMP-5.
03 Clients-AnwendungsId-NULL PIC S9(04) COMP-5.

What is the right way to move Benutzername to Clients-Benutzername.

If i code move benutzername to Clients-Benutzername and insert the row into the table,

Clients-Benutzername is for example  "Thomas" rest filled with space.

 

Thank you Chris. It works perfect.