View previous topic :: View next topic
|
Author |
Message |
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Hi
EXEC SQL
SET :FILE-VAR = CURRENT TIMESTAMP
END-EXEC
In above statement, current timestamp is not set to FILE-VAR(variable defined in file layout) for all the records. I can see value set only for 4 records among 10 total records. But the SQLCODE of this statement is zero for all records.
I changed FILE-VAR to WS-VAR and can see current timestamp getting populated for all the records. Why is it not populated properly for all records if file variable is used whereas working fine for working storage var.
Shobana |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Shobana,
Would You please provide the code ? |
|
Back to top |
|
|
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Hi Ekta,
I have already mentioned my code.
EXEC SQL
SET :WS-LST-UPDT-TS = CURRENT TIMESTAMP
END-EXEC
IF SQLCODE NOT = ZERO
Call Abend Routine
The above code worked fine as i replaced FILE-LST-UPDT-TS (var defined in file layout) with WS-LST-UPDT-TS. But i don know why file variable is not working fine |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Sobhana,
I asked u to paste ur code because i want to see how u are initializing ur file record |
|
Back to top |
|
|
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
FILE-CONTROL.
SELECT IN-FTP ASSIGN TO INFTP
FILE STATUS IS INFTP-STATUS.
DATA DIVISION.
FILE SECTION.
FD IN-FTP
DATA RECORD IS INPUT-RECORD.
01 INPUT-RECORD.
file var declarations
WORKING-STORAGE SECTION.
01 WS-WORKING.
ws var declarations
PROCEDURE DIVISION.
PERFORM 1000-OPEN-FILES THRU
1000-OPEN-FILES-EXIT.
PERFORM 2000-PROCESS-PARA THRU
2000-PROCESS-PARA-EXIT
UNTIL WS-EOR = 'Y'.
PERFORM 9000-CLOSE-FILES THRU
9000-CLOSE-FILES-EXIT.
STOP RUN.
1000-OPEN-FILES.
OPEN INPUT IN-FTP.
IF NOT INPUT-GOOD
DISPLAY ' '
DISPLAY 'BAD OPEN OF INPUT FILE' INFTP-STATUS
MOVE '1001' TO WS-ABEND-CODE
GO TO 9999-ABEND
END-IF.
1000-OPEN-FILES-EXIT.
EXIT.
2000-PROCESS-PARA.
INITIALIZE INPUT-RECORD.
READ IN-FTP
AT END MOVE 'Y' TO WS-EOR
PERFORM 3000-READ-WRITE THRU 3000-READ-WRITE-EXIT
2000-PROCESS-PARA-EXIT.
EXIT.
3000-READ-WRITE.
EXEC SQL
SET :WS-LST-UPDT-TS = CURRENT TIMESTAMP
END-EXEC
IF SQLCODE NOT = ZERO
DISPLAY 'SET CURRENT TIMESTAMP - IN ERROR'
MOVE '3003' TO WS-ABEND-CODE
GO TO 9999-ABEND
ELSE
MOVE WS-LST-UPDT-TS TO IN-LST-UPDT-TS
END-IF. |
|
Back to top |
|
|
Suryanarayana.tadala
New User
Joined: 03 Nov 2005 Posts: 43 Location: St.Louis
|
|
|
|
How did u declare this variable WS-LST-UPDT-TS |
|
Back to top |
|
|
Suryanarayana.tadala
New User
Joined: 03 Nov 2005 Posts: 43 Location: St.Louis
|
|
|
|
Is the variable FILE-LST-UPDT-TS a part of a copybook/file layout ???
If so you cannot use them as Host variables in DB2.Probably you might have got the data for couple of records due to stack but it would not work fine thru out the execution.
Only a DCLGEN copybook varaibles can be used as Hostvariables.
Correct me if i am wrong.. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Suryanarayana.tadala wrote: |
Is the variable FILE-LST-UPDT-TS a part of a copybook/file layout ??? |
Good call, without more feedback beyond
Quote: |
DATA RECORD IS INPUT-RECORD.
01 INPUT-RECORD.
file var declarations
WORKING-STORAGE SECTION.
01 WS-WORKING.
ws var declarations
PROCEDURE DIVISION. |
"var declarations" does leaves a lot of questions....
But of course, we have to assume he knows that COBOL copybooks are not resolved until after the DB2 precompile.... |
|
Back to top |
|
|
Shobana Bhaskar
New User
Joined: 02 Mar 2007 Posts: 35 Location: Pennsylvania, US
|
|
|
|
Yes.. FILE-LST-UPDT-TS is a part of file layout defined in program and not copybook variable.
DATA RECORD IS INPUT-RECORD.
01 INPUT-RECORD.
05 FILE-LST-UPDT-TS PIC X(26).
WORKING-STORAGE SECTION.
01 WS-WORKING.
05 WS-LST-UPDT-TS PIC X(26).
Hi Suryanarayana,
Why ONLY DCLGEN var can be used as host variable?? But Working Storage variable is working fine!!! |
|
Back to top |
|
|
|