write 'C','M','Q','Y' in out put file based on date



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

write 'C','M','Q','Y' in out put file based on date

Postby thotlma » Sun Feb 03, 2019 8:37 pm

Hi All

iam new to cobol could you please help to get the cobol code for below requirement
i have filed in DB2 table. the filed should be update based on below requirement
the job will run every week in month. first it will read Mainframe system date then we have write below codes based on the condition

Mar Month End data - Q
June Month data - Q
September month End data - Q
December Month end data - Y
Rest of the month end data - M

example: suppose i will take January 2019
the job will run on 01/01/2019 the field value is 'Y' (it will take previous year last week data)
the job will run on 01/05/2019 the field value is 'C'
the job will run on 01/12/2019 the field value is 'C'
the job will run on 01/19/2019 the field value is 'C'
the job will run on 01/26/2019 the field value is 'C'
the job will run on 02/01/2019 the field value is 'M'(it will take previous month end data)

please help some one to get this ocde that would be appriciate?
thotlma
 
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Has thanked: 0 time
Been thanked: 0 time

Re: write 'C','M','Q','Y' in out put file based on date

 

Re: write 'C','M','Q','Y' in out put file based on date

Postby prino » Sun Feb 03, 2019 8:55 pm

Why would we help someone who's not even able to post in an appropriate forum?

What the flucking 'ell has COBOL to with Forum Rules????
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 591
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 26 times

Re: write 'C','M','Q','Y' in out put file based on date

Postby Robert Sample » Mon Feb 04, 2019 12:39 am

I moved the posts from Forum Rules to IBM Cobol.

Your post is quite confusing -- you state that the job will run weekly; not every month has its first day on the same day of the week (January 1st was a Tuesday while February, for example, had the 1st on a Friday). So how are you planning to accommodate that? If the job ran daily, what you want to do is trivial. With a weekly job frequency, it will take advanced (and complex) logic to be able to accomplish your goal. Perhaps you should try for a daily job frequency?
Robert Sample
Global moderator
 
Posts: 3620
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 267 times

Re: write 'C','M','Q','Y' in out put file based on date

Postby NicC » Mon Feb 04, 2019 4:54 pm

Why are you making the flag 'C'? That is not in your list of flags (M, Q and Y).
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2937
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 133 times

Re: write 'C','M','Q','Y' in out put file based on date

Postby enrico-sorichetti » Mon Feb 04, 2019 5:17 pm

the real problem here is not the code ( whatever the language )

but the really bad description/understanding of the logic .

what really makes me wonder about the competence of the organisation ( the people )
is the poor understanding of week concept as far as the date processing is concerned

if the logic is clear the frequency of the run will be irrelevant ...

furthermore we must consider the legal point of view .

for internal use how to determine the first/last week of the year/month is really irrelevant

but when the data is shared with outside organisations there are some rules to follow ( ISO stuff )
expecially when the week crosses years
the last days of december might belong to the first week of the following year
the first days of january might belong to the last week of the previous year

there are quite many good reasons why the reference date for a process is most often given as a parameter
rather than automatically computed

remember IT is not just the lowly technicalities but understanding of the process and the constraint/rules
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2884
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 153 times

Re: write 'C','M','Q','Y' in out put file based on date

Postby thotlma » Mon Feb 04, 2019 6:31 pm

Robert Sample wrote:I moved the posts from Forum Rules to IBM Cobol.

Your post is quite confusing -- you state that the job will run weekly; not every month has its first day on the same day of the week (January 1st was a Tuesday while February, for example, had the 1st on a Friday). So how are you planning to accommodate that? If the job ran daily, what you want to do is trivial. With a weekly job frequency, it will take advanced (and complex) logic to be able to accomplish your goal. Perhaps you should try for a daily job frequency?


Hi Robert

Thanks for reply and sorry for making you consfused
This weekly job only but start from every Jan 1
please see the current run in production

XXSDA940 2019/01/01 06.29.28(here value will be 'Y' because it will take previous year end data)
XXSDA940 2019/01/05 02.11.49(Here value 'C')
XXSDA940 2019/01/12 01.49.31(Here value 'C')
XXSDA940 2019/01/19 00.38.52(Here value 'C')
XXSDA940 2019/01/26 00.25.00(Here value 'C')
XXSDA940 2019/02/01 03.40.02(Here value 'M' because it will take previous month end data)
thotlma
 
Posts: 25
Joined: Tue Sep 18, 2018 8:05 pm
Has thanked: 0 time
Been thanked: 0 time

Re: write 'C','M','Q','Y' in out put file based on date

Postby enrico-sorichetti » Mon Feb 04, 2019 6:46 pm

where is that You are facing problems ...
the logic or the code ?

You can ask on a forum how to fix Your bad code, You cannot ask for somebody to provide it
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2884
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 153 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post