IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Date option in DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 5:11 pm
Reply with quote

Hi,

I want to find last date of previous month using DFSORT, is any option available in the DFSORT?
Please, help me regarding this

Thanks
Jahnavi
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jun 05, 2007 5:18 pm
Reply with quote

Have you looked at the sort manual?
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 5:30 pm
Reply with quote

I have gone through sort manuals, I have got the option to find the previous month but I did not find any option to get last day of the previous month.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 05, 2007 5:32 pm
Reply with quote

It can be done in REXX
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 05, 2007 5:33 pm
Reply with quote

I forgot to ask why the must for using DFSORT ???
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 5:41 pm
Reply with quote

Hi,
We can do it using COBOL program or REXX, but I supposed to use DFSORT.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 05, 2007 5:43 pm
Reply with quote

Is this HOMEWORK ???
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jun 05, 2007 5:46 pm
Reply with quote

Cketha wrote:
I have got the option to find the previous month but I did not find any option to get last day of the previous month.
The usual way , if the tools are available, would be to plug the dd of your mmddyy with a 01, convert to julian yyddd, subtract 1 from the ddd and convert back to mmddyy.
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 5:48 pm
Reply with quote

hey, this is not a homework...
It's bcoz it saves processing time we are sorting a file.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 05, 2007 5:55 pm
Reply with quote

Quote:
hey, this is not a homework...
It's bcoz it saves processing time we are sorting a file.

Apologies, it just sounded like a homework question until you clarified further.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jun 05, 2007 5:58 pm
Reply with quote

Cketha wrote:
I want to find last date of previous month using DFSORT, is any option available in the DFSORT?
OK, fill in some information, please.
The stated requirement to use sort to generate a date is a bit thin.....
Where is the previous month coming from? The current month? A field in the input?
What are you doing with the last day of the previous month? Comparing it to a field in the input?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 05, 2007 6:02 pm
Reply with quote

In the past, I have used REXX to build the control statements for DFSORT, for something similar.
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 6:09 pm
Reply with quote

Hi
As you said we can get the current date, How can we convert date to 01 and use the Julian Date function in the sort card?
Actually our requirment is to populate fields from input files along with RPT-DATE(previous month last day) to the output file.
This is the new field added in the output file.

Thanks
Jahnavi
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Jun 05, 2007 6:18 pm
Reply with quote

So you need the date of the last day of the previous month in a sort control card, right?
I don't know, but Frank can do some magic in creating sort input for a following sort step....
And as expat said, he has "used REXX to build the control statements for DFSORT".....
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 6:19 pm
Reply with quote

Hey, It's Ok.
I am not familiar with REXX.
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Tue Jun 05, 2007 6:39 pm
Reply with quote

William Thompson wrote:
So you need the date of the last day of the previous month in a sort control card, right?
I don't know, but Frank can do some magic in creating sort input for a following sort step....
And as expat said, he has "used REXX to build the control statements for DFSORT".....


I have two files First file(having thousanda of records) with 10 field and spaces in date field , Second file contains a date field only one record.
I want to populate all the records from first file with date field added from second file to the output file.
Can you help me regarding this?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jun 05, 2007 8:32 pm
Reply with quote

Please show an example of the records in each input file and what you expect for output. Give the starting position, length and format of all relevant fields. Give the RECFM and LRECL of each input file. Explain the "rules" for getting from input to output.

Also, do you only have 20yy dates? Or do you have 20yy and 19yy dates?
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Wed Jun 06, 2007 9:34 am
Reply with quote

Frank Yaeger wrote:
Please show an example of the records in each input file and what you expect for output. Give the starting position, length and format of all relevant fields. Give the RECFM and LRECL of each input file. Explain the "rules" for getting from input to output.

Also, do you only have 20yy dates? Or do you have 20yy and 19yy dates?


Hi,
Sorry I couldn't to relply you.
First I/p file following fields
eno. x(10), sys_id 9(10),name x(40), bal 9(10)
This file contains thousand of records

Second file has
ddate(10)
This file has one record.

output file structure
eno. x(10), sys_id 9(10),date x(10), name x(40), bal 9(10),ldno 9(10)
I have to populate first files record along with date from second file
in all the records as per the abbove file structure..
Few extra fields are in d output files those will b polulated with zeros or
spaces
can u help me to prepare sort card for this?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Jun 06, 2007 12:20 pm
Reply with quote

Cketha
your output file structure

Quote:
eno. x(10), sys_id 9(10),date x(10), name x(40), bal 9(10),ldno 9(10)

contains "ldno" which is not specified in any of the i/p's, clarify this.

It would be better if you are providing a set of sample i/p records, as to how your i/ps look, for clear understanding of your request.
Back to top
View user's profile Send private message
Cketha
Warnings : 1

New User


Joined: 19 May 2007
Posts: 22
Location: mumbai

PostPosted: Wed Jun 06, 2007 6:12 pm
Reply with quote

Hi,

I m giving u some sample records
I/p file 1
eno. x(10) sys_id 9(10), name x(10) bal 9(10)
1111111111 1212121212 aaaaaaaaaa 1000000000
2222222222 2121212121 bbbbbbbbbb 2000000000
3333333333 3131313131 cccccccccccc 3000000000

File1 file contain thousands of records...


I/p file 2.. only 1 record
date X(10)
2007-01-31

yyyy-mm-dd

This is how i/p files are


I want to populate all the records of file 1 with same date as it is in file 2
to o/p file with structure as follow

O/p I need
eno. x(10) sys_id 9(10), dno x(10) name x(10) bal 9(10) lno9(10)
1111111111 1212121212 2007-01-31 aaaaaaaaaa 1000000000 00000000
2222222222 2121212121 2007-01-31 bbbbbbbbbb 2000000000 00000000
3333333333 3131313131 2007-01-31 cccccccccccc 3000000000 00000000

using sortcard, Can you help regarding this?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jun 06, 2007 8:49 pm
Reply with quote

Cketha,

In your first post, you said
Quote:
I want to find last date of previous month using DFSORT, is any option available in the DFSORT?


Now in this post you say you just want to add the date from file1 to the records in file2. I don't know what the first statement has to do with the second, but you can add the date from file1 to the file2 records using this DFSORT job:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file2 (date)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(C'MYDATE,''',1,10,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file1
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(1,20,MYDATE,21,50,C'0000000000')
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top