IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Current Timestamp not assigned to File variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Tue Mar 13, 2007 1:45 pm
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Mar 13, 2007 2:22 pm
Reply with quote

Hi Shobana,

Would You please provide the code ?
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Tue Mar 13, 2007 7:09 pm
Reply with quote

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 icon_sad.gif
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Mar 13, 2007 7:12 pm
Reply with quote

Hi Sobhana,

I asked u to paste ur code because i want to see how u are initializing ur file record
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Thu Mar 15, 2007 1:17 pm
Reply with quote

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
View user's profile Send private message
Suryanarayana.tadala

New User


Joined: 03 Nov 2005
Posts: 43
Location: St.Louis

PostPosted: Fri Mar 16, 2007 4:16 am
Reply with quote

How did u declare this variable WS-LST-UPDT-TS
Back to top
View user's profile Send private message
Suryanarayana.tadala

New User


Joined: 03 Nov 2005
Posts: 43
Location: St.Louis

PostPosted: Fri Mar 16, 2007 4:19 am
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 16, 2007 4:40 am
Reply with quote

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.... icon_confused.gif
But of course, we have to assume he knows that COBOL copybooks are not resolved until after the DB2 precompile.... icon_lol.gif
Back to top
View user's profile Send private message
Shobana Bhaskar

New User


Joined: 02 Mar 2007
Posts: 35
Location: Pennsylvania, US

PostPosted: Fri Mar 16, 2007 12:30 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts To get the count of rows for every 1 ... DB2 3
Search our Forums:

Back to Top