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
 

 

Precompiler errors - Passing host varibale to dayofweek

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
neelusoni

New User


Joined: 13 Nov 2010
Posts: 2
Location: Boston MA

PostPosted: Wed Nov 17, 2010 10:52 pm    Post subject: Precompiler errors - Passing host varibale to dayofweek
Reply with quote

Hi All,

In my program it is required to find last working day of the year. For which I have created the following code. I am getting precompilation errors for this. Am I doing something wrong here? Please help

Working storage
Code:
01 WS-LAST-DATE.
     05 WS-LAST-MM           PIC X(02).
     05 FILLER                    PIC X(01) VALUE '/'.
     05 WS-LAST-DD           PIC X(02).
     05 FILLER                    PIC X(01) VALUE '/'.
     05 WS-LAST-YYYY        PIC X(04).
01 WS-LAST-WORK-DAY    PIC 9(02) COMP.

Procedure division
Code:
MOVE WSC-CURR-DTE(1:4) TO WS-LAST-YYYY
MOVE 12                            TO WS-LAST-MM
MOVE 31                            TO WS-LAST-DD

EXEC SQL
      SELECT CASE DAYOFWEEK(DATE(:WS-LAST-DATE))
                  WHEN 1 THEN 29
                  WHEN 7 THEN 30
                  ELSE 31
                  END
         INTO :WS-LAST-WORK-DAY
         FROM SYSIBM.SYSDUMMY1
END-EXEC

where WSC-CURR-DTE is current julian date.

Precomiler errors
Code:

UNDEFINED OR UNUSABLE HOST VARIABLE "WS-LAST-DATE"
UNDEFINED OR UNUSABLE HOST VARIABLE "WS-LAST-WORK-DAY"


Regards,
Neelu Soni
Back to top
View user's profile Send private message

Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 186
Location: chennai

PostPosted: Wed Nov 17, 2010 11:28 pm    Post subject: Reply to: Precompiler errors - Passing host varibale to dayo
Reply with quote

Hi Neelu Soni

Quote:
Am I doing something wrong here?


I suggest you 2 changes in the variable declaration.

1. 01 WS-LAST-DATE PIC X(10).
The variable must be PIC X(10).

2. 01 WS-LAST-WORK-DAY PIC S9(9) COMP.
Because the result of the function DAYOFWEEK is a large integer.

Hope this will help you

Regards
Raghu
Back to top
View user's profile Send private message
neelusoni

New User


Joined: 13 Nov 2010
Posts: 2
Location: Boston MA

PostPosted: Thu Nov 18, 2010 1:36 am    Post subject: Reply to: Precompiler errors - Passing host varibale to dayo
Reply with quote

Thanks Raghu.

That works. So would that mean that Dayofweek function (for that matter any scalar function) requires an elementary level host variable as the input parameter, Group variables would not work?
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Thu Nov 18, 2010 12:55 pm    Post subject:
Reply with quote

All date-HV must be elementary pic x(10).
integers must be s9(9) comp
This is basic DB2 knowledge.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Several errors during building altern... Andi1982 JCL & VSAM 11 Wed Jul 06, 2016 7:39 pm


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