Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us