julian date conversion into 'ccyy-mm-dd'

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

julian date conversion into 'ccyy-mm-dd'

Post by srikie »

Hi,
I am working on DS MVS edition. Can any one suggest me on how to convert julian date which is of 'ccyy-ddd' format to 'ccyy-mm-dd'.
As I am working on msv edition I dont have the comfort of using server routines.
Thanks
Srikie
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Here's the best option to accomplish this:

Let DataStage do its automatic date reformatting. You will need to specify a date format for the source date and a date format for the target date. There isn't a date format for CCYY-DDD, but there is one for CCYYDDD. You can reformat CCYY-DDD into CCYYDDD using substring/concatenation. Then you can simply map the CHAR(7) column with date format CCYYDDD to a CHAR(10) column with date format CCYY-MM-DD and DataStage will automatically convert.

Mike
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Thanks, actually my source date format is 'CCYYDDD'. Can you tell me how to specify date format for source and target seperately. I can see there is only one date format option available in job properties and it does have 'CCYYDDD'.
Srikie
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

It's not specified at the job level in job properties. It's specified at the column level within a stage. For example, in a fixed-width flat file stage, go to the columns tab and right-click on your date column. Select "edit row" and this will bring up a form dialog. There is a drop-down list for selecting a date format.

Mike
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

My source file is vsam file. When I try to change the date format for that column bcoz its a group it doesnt give any listing the drop-down list.
But when I changed column type from group to character, it gives me the
Error: Group column cannot have data type other than GROUP.
Error: Maximum file record size must be equal to or greater than 297
Can you tell mehow to deal with this. I mean with out holding into a temporary stage variable.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

It needs to go in the 'Date format' of your column defn.
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Sainath.Srinivasan wrote:It needs to go in the 'Date format' of your column defn.
I am sorry I dint get you.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

From your words, it appears that this date value is provided in a variable which has a corresponding group level field which you are trying to fiddle with.

You cannot change a group level field without affecting the child fields.

So you first need to locate the child field which immediately follows the group and has an higher level number.

As you said, the input must be of CCYYDDD format as your source data is of that format.

In the target, goto the field defn in Designer, right click on the column and select 'Edit Row'.

This will open up a larger screen with more column metadata. You will also find a COBOL folder in it.

As part of the column properties, you will be able to see the 'Date Format' drop-down list from which you need to select the desired output format.

Note that DataStage maps values depending on the format you provide.

Once this is done, you need to generate and move the codes to mainframe for further processing.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

It sounds as if your date was defined something like this in your COBOL FD:

Code: Select all

05  CCYYDDD.
    10  CCYY   PIC X(4).
    10  DDD    PIC X(3).
I believe you are correct in saying that you can't specify a date format for a group-level column.

I think you'll have to change your FD to eliminate the group. I think the easiest way is probably to make the change in your CFF stage directly. In my example, you would need to delete the CCYY and DDD columns, change the CCYYDDD from a group column to a CHAR(7) column, and then you should be able to select a date format.

You shouldn't get the "Group column cannot have data type other than GROUP" error when the lower level columns are deleted.

Mike
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Hi Sainath
My source format is :

20 FM132-SER-NUM-JULIAN-DATE.
25 FM132-SER-NUM-JULDT-CCYY.
30 FM132-SER-NUM-JULDT-CC PIC X(02).
30 FM132-SER-NUM-JULDT-YY PIC X(02).
25 FM132-SER-NUM-JULDT-DDD PIC X(03).

Now when I try to change child elements date format according to ccyyddd it gives me error that date format cannot exceed the column length. When I try to set the date format for Group it doesnt give me any
option to select in the dropdown list.
I understood wher to set the date format but this case it is different.
If I am not clear please let me know I will give more info.
Thanks
srikie
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Use a new field with 'REDEFINE' as CHAR(7) - i.e. PIC X(7) just below the 'DDD' field with the same level number as your group field and perform your actions in the new field.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

srikie,
You can try the suggestion by Sainath.Srinivasan,
or I think this should work as well:

Delete these four columns:

Code: Select all

25 FM132-SER-NUM-JULDT-CCYY. 
30 FM132-SER-NUM-JULDT-CC PIC X(02). 
30 FM132-SER-NUM-JULDT-YY PIC X(02). 
25 FM132-SER-NUM-JULDT-DDD PIC X(03). 
Change this column from GROUP to CHAR(7) and specify date format:

Code: Select all

20 FM132-SER-NUM-JULIAN-DATE.
Mike
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Yep. The suggestion by Mike will do the trick. But you need to be careful and ensure that you do not use the columns you intend to delete in your job.
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Well, I am not sure if I am allowed to do that (deleting or redefining the format). But thanks for your valuable suggestions.
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

I could see the in the dateformat there is an option '99999999'. Does that mean its in 9s complement format. and if we map it to ccyy-mm-dd. does ascential take care of all the conversion stuff?
Post Reply