Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Current Timestamp not assigned to File variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Current Timestamp not assigned to File variable
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: 1187
Location: Bangalore,India

PostPosted: Tue Mar 13, 2007 2:22 pm    Post subject:
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    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Tue Mar 13, 2007 7:12 pm    Post subject:
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    Post subject: Re: Current Timestamp not assigned to File variable
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    Post subject:
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Mar 16, 2007 4:40 am    Post subject:
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    Post subject: Re: Current Timestamp not assigned to File variable
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us