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
 

 

How to find the current day

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
mydukurkishan

New User


Joined: 20 Jul 2006
Posts: 1
Location: Chennai

PostPosted: Tue Oct 24, 2006 2:23 pm    Post subject: How to find the current day
Reply with quote

Hi,
Is there any function in cobol to find out what day is today (ex : Friday or Satur day) based on the current date .

If any one knows please help me in this
Back to top
View user's profile Send private message

ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Oct 24, 2006 5:17 pm    Post subject: Re: How to find the current day
Reply with quote

i dont think thr is ny cobol intrinsic date function available for this ...

use the following routine

IDENTIFICATION DIVISION.
PROGRAM-ID. WHATDAY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC 99 VALUE ZERO.
01 B PIC 9 VALUE ZERO.
01 C PIC 99 VALUE ZERO.
01 F VALUE "12060708091011".
05 FF PIC 99 OCCURS 7.
01 E PIC 9999 VALUE 2000.
01 T PIC 9999 VALUE ZERO.
01 I PIC 9 VALUE 1.
LINKAGE SECTION.
01 Y PIC 9(4).
01 M PIC 9(2).
01 D PIC 9(2).
01 DDY PIC X(3).
PROCEDURE DIVISION USING Y M D DDY.
0001A.
IF Y < 2000 DISPLAY "INVALID YEAR" GO 0000Z.
IF M < 1 OR > 12 DISPLAY "INVALID MONTH" GO 0000Z.
IF D < 1 OR > 31 DISPLAY "INVALID DATE" GO 0000Z.
MOVE D TO C.
0000X.
COMPUTE A = FF ( I ).
IF E = Y GO 0000Y.
ADD 1 TO I.
IF I > 7 COMPUTE I = 1.
DIVIDE E BY 4 GIVING T REMAINDER B.
IF E < Y AND B = 0 ADD 1 TO I.
IF I > 7 COMPUTE I = 1.
ADD 1 TO E.
GO 0000X.

0000Y.
IF B = 0 AND M > 2 ADD 1 TO A.
IF M = 1
ADD A TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 2
ADD A 3 TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 3
ADD A 3 TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 4
SUBTRACT 1 FROM A
ADD A TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 5
ADD A 1 TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 6
ADD A 4 TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 7
SUBTRACT 1 FROM A
ADD A TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 8
ADD A 2 TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 9
SUBTRACT 2 FROM A
ADD A TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 10
ADD A TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 11
ADD A 3 TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE IF M = 12
SUBTRACT 2 FROM A
ADD A TO D
DIVIDE D BY 7 GIVING A REMAINDER B
ELSE DISPLAY "DATA TYPE INVALID".
IF B = 0 MOVE "SUN" TO DDY
ELSE IF B = 1 MOVE "MON" TO DDY
ELSE IF B = 2 MOVE "TUE" TO DDY
ELSE IF B = 3 MOVE "WED" TO DDY
ELSE IF B = 4 MOVE "THU" TO DDY
ELSE IF B = 5 MOVE "FRI" TO DDY
ELSE IF B = 6 MOVE "SAT" TO DDY
ELSE DISPLAY "COBOL RUNTIME ERROR".
0000Z.
EXIT PROGRAM.

change as per ur need .....
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue Oct 24, 2006 5:49 pm    Post subject: Re: How to find the current day
Reply with quote

if LE available read about CEEDYWK?calculate day of week from Lilian date:

http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=/com.ibm.aix.cbl.doc/rpsrv15.htm
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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am


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