View previous topic :: View next topic
|
Author |
Message |
omprakash.mf
New User
Joined: 06 Jul 2010 Posts: 12 Location: hyderabad
|
|
|
|
Hi,
I have a string eg: string1 ="username.system.ccyymmdd.abc".
That string is a dataset name and the date value is dynamic which changes on daily bases. I dont know the lenght of the dataser name. It is also dynamic.
How can I change the value of the date everyday.
Please suggest me. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
The 3LQ will be invalid on the mainframe |
|
Back to top |
|
|
nigelosberry
New User
Joined: 06 Jan 2009 Posts: 88 Location: Ggn, IN
|
|
|
|
omprakash.mf wrote: |
Hi,
I dont know the lenght of the dataser name. It is also dynamic.
Please suggest me. |
Can you confirm if the date part i.e. ccyymmdd will always be the third qualifer in the dataset name?
A qualifier must start with a character. |
|
Back to top |
|
|
omprakash.mf
New User
Joined: 06 Jul 2010 Posts: 12 Location: hyderabad
|
|
|
|
Hi nigelosberry,
Yes, it is always the third qualifier in the dataset name.
Ok think it that the third qualifier be like this ACCYYMMDD. where 'A' is a character. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
A qualifier of 9 characters is not valid. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Wrong, maximum length of eight for each qualifier |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Peter, what are you doing here, you are supposed to be on the naughty step |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
expat wrote: |
Wrong, maximum length of eight for each qualifier |
My my expat,
a little slow? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Various ways (once you sort out the validity). Check, as always it seems, STRING, UNSTRING & INSPECT in the manuals.
You don't need the century in your date. You're not going to back-date any datasets 11 years are you? And, at a guess, the same system isn't going to be running in 89 years time. |
|
Back to top |
|
|
omprakash.mf
New User
Joined: 06 Jul 2010 Posts: 12 Location: hyderabad
|
|
|
|
Hi Expat,
Ok. Qualifier will be with 7 bytes size and it is in th form like AYYMMDD. |
|
Back to top |
|
|
nigelosberry
New User
Joined: 06 Jan 2009 Posts: 88 Location: Ggn, IN
|
|
|
|
omprakash.mf wrote: |
Hi nigelosberry,
Ok think it that the third qualifier be like this ACCYYMMDD. where 'A' is a character. |
As suggested, the qualifier must fit in 8 bytes.
I have seen data set names using dates in past. The format there looks something like:
dyymmdd
where :
'd' is a constant
yy, mm and dd are diff components of date date
but if you want to include the full 'ccyy' in your dateset name instead of only 'yy', you could as well consider using date in julian(i.e. ordinal) format. |
|
Back to top |
|
|
nigelosberry
New User
Joined: 06 Jan 2009 Posts: 88 Location: Ggn, IN
|
|
|
|
omprakash.mf wrote: |
Hi,
I have a string eg: string1 ="username.system.ccyymmdd.abc".
That string is a dataset name and the date value is dynamic which changes on daily bases. I dont know the lenght of the dataser name. It is also dynamic.
How can I change the value of the date everyday.
Please suggest me. |
By the way -
(1)are you creating a dataset from inside your cobol program dynamically?
(2)Or you just want to process the dataset name(for writing to a report etc.)?
(3)Or you have this dataset name in your jcl which needs changing daily? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
COBOL does not have "strings" like C, Visual Basic, Perl, or .... In COBOL, the maximum length of EVERY variable is known at compile time. Making statements like
Quote: |
I dont know the lenght of the dataser name. It is also dynamic. |
shows just how little you know about COBOL. The only time a variable length can be dynamic is if (1) the variable has OCCURS DEPENDING ON, and (2) the variable is defined in LINKAGE SECTION. And even if those conditions are met, there still are no strings involved -- just alphanumeric variables.
omprakash.mf, terminology is critical in IT, where similar terms may mean very different things. Your using the term "string" when talking about COBOL indicates a lot of your lack of knowledge and skill. You need to learn the right COBOL terms and use them.
As long as your date value is in the third level of the data set name qualifier, you can use INSPECT or reference modification to find the three periods in the data set name; 2 bytes past the third period will start your date. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Bill Woodger wrote: |
Various ways (once you sort out the validity). Check, as always it seems, STRING, UNSTRING & INSPECT in the manuals.
You don't need the century in your date. You're not going to back-date any datasets 11 years are you? And, at a guess, the same system isn't going to be running in 89 years time. |
Yeah, that's what we said back in 1979 |
|
Back to top |
|
|
nigelosberry
New User
Joined: 06 Jan 2009 Posts: 88 Location: Ggn, IN
|
|
|
|
An easy way I could think of:
Code: |
INITIALIZE W-1LQ W-2LQ W-3LQ W-4LQ
UNSTRING W-X DELIMITED BY '.'
INTO W-1LQ W-2LQ W-3LQ W-4LQ
MOVE W-YOUR-DATE TO W-3LQ
MOVE SPACES TO W-X
STRING W-1LQ '.' W-2LQ '.' W-3LQ '.' W-4LQ
DELIMITED BY SPACE
INTO W-X |
where W-X is the dataset name.
(Please test ) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Test data
Code: |
This line intentionally left blank
ABC
ABC.DEF
ABC.DEF.dateplaceholder
ABC.DEF.dateplaceholder.GHI
ABC.DEF.GHI.dateplaceholder
ABC.DEF.GHI
ABC.DEF.GHI
dateplaceholder
ABC.dateplaceholder.DEF
ABC.DEF.GHI.JKL.MNO.PQR etc to max no of qualifiers
etc
|
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
If I got the question correctly, searching for EZACFSM1 might give you what you are looking for. |
|
Back to top |
|
|
|