View previous topic :: View next topic
|
Author |
Message |
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Have you looked at the sort manual? |
|
Back to top |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
It can be done in REXX |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I forgot to ask why the must for using DFSORT ??? |
|
Back to top |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
Hi,
We can do it using COBOL program or REXX, but I supposed to use DFSORT. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Is this HOMEWORK ??? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
hey, this is not a homework...
It's bcoz it saves processing time we are sorting a file. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
In the past, I have used REXX to build the control statements for DFSORT, for something similar. |
|
Back to top |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
Hey, It's Ok.
I am not familiar with REXX. |
|
Back to top |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
Cketha Warnings : 1 New User
Joined: 19 May 2007 Posts: 22 Location: mumbai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|