View previous topic :: View next topic
|
Author |
Message |
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
I need to reformat a dataset.
Following is the data in my dataset1.
Dataset1:
Date - xxxx/xx/xx
Page - xx
Todays report details
xxx xxx xxxxxxxxxxxx xxxxxx xxxx xxxxx
-------------------------------------------------------
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
I need these data to be written to another dataset2.It should have th following details only :
Dataset2:
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
xxx xxx xxxxxxxxxxxxx xxxxxxx xxxx xxxxx
Can you please help?
Regards,
Neena |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
KS
If you are sure that the actual data starts from 4th or 5th or nth line then you can use STARTREC feature in SORT and copy the required information.
like
Code: |
//SYSIN DD *
SORT FIELDS=COPY,STARTREC=5
// |
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You need to be more specific about what the data looks like and what you want.
It appears that you just want the data records, not the headings, but it's difficult to tell for sure since you show 6 data records in the input file but only 4 data records in the output file. Do you really want to remove some of the data records? If so, based on what "rules"?
We can use DFSORT's OMIT statement to remove the records you don't want, but we need to specify exact conditions for the records to be removed, e.g. 1,4,CH,EQ,C'Date'. To do that, we need to know what the records actually look like. So please show an example of your input records and expected ouput records with the actual values. Also, give the RECFM and LRECL of the input file.
Are the blank records you show actually in the data set? If not don't show them in the new example. |
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
Code: |
SPF/E VIEW MSTEST.SJ564D1N.SGG564P0.REPORT Columns
00001 00072
****** ***************************** Top of Data ******************************
000001 1DATE 09/07/07
000002 ABC COMP - Instructions list
000003 PAGE 1
000004 0NAME ; YEAR ; CUR ; DEPT ; AMOUNT ;XX ; AAA ; AREF ;
000005 AAAA ; 0001 ; ABC ; ZB ; 91935.44 ; W ; ABC ; 123434001000 ;
000006 BBBB ; 0002 ; DEF ; ZB ; 91935.44 ; W ; DEF ; 123545401000 ;
000007 CCCC ; 0003 ; GHI ; ZB ; 91935.44 ; W ; GHI ; 123353401000 ;
000008 DDDD ; 0004 ; JKL ; ZB ; 91935.44 ; W ; JKL ; 123434001000 ;
000009 EEEE ; 0005 ; MNO ; ZB ; 91935.44 ; W ; MNO ; 123434001000 ; |
|
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
Hi all..
Thanks for your reply.
Above is the dataset.
I want to remove the DAte,PAge and the topic header and write to a different dataset.
Kindly help
Regards,
KS |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
KS
Since you want to skip first 3 lines, you can use this sort card
Code: |
//SYSIN DD *
SORT FIELDS=COPY,STARTREC=4
// |
|
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
i tried the above code but am not getting the result
am geeting an error
I gave like this
//S025T EXEC MSSORT,MODE=TEST
//SORTIN DD DSN=DATASET1,DISP=SHR
//SORTOUT DD DSN=DATSET3,DISP=SHR
//SYSIN DD *
SORT FILEDS=COPY,STARTREC=4
i got and abend.what is the mistake am doing?
i got the following error :
SORT STATEMENT : SYNTAX ERROR
PLEASE HELP. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
KS wrote: |
i got the following error :
SORT STATEMENT : SYNTAX ERROR |
Please provide the full error output. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
KS
try this
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL STARTREC=4
// |
|
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
thats all the error its throwing . |
|
Back to top |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
Its working fine..
Thank you so much.
Thanks to one and all who replied.
Regards,
KS |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Krisprems,
You're getting the syntax confused for different control statements.
The OPTION COPY or SORT FIELDS=COPY statement has SKIPREC=n and STOPAFT=n.
The OUTFIL statement has STARTREC=n and ENDREC=n.
Please, please test your control statements before you post them so we don't have to have a series of "try this - it doesn't work - try this" posts which just confuse people. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I want to remove the DAte,PAge and the topic header and write to a different dataset. |
KS,
To me that says you want to remove the 4th, 6th and 7th records, not the first 3 records as Krisprems assumed. It would have helped if you'd shown the expected output for your input example and described more clearly what you wanted to do. If you've gotten what you want, fine. But if you haven't, then please post again showing clearly what you want to do. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Frank
Quote: |
Please, please test your control statements before you post them |
Sorry for this. As you said i confused with SKIPREC and STARTREC.
Quote: |
To me that says you want to remove the 4th, 6th and 7th records, not the first 3 records as Krisprems assumed |
According to I/P provided by KS, the first three lines to be skipped are these which contain the DATE, TOPIC HEADER and PAGE
Code: |
000001 1DATE 09/07/07
000002 ABC COMP - Instructions list
000003 PAGE 1
|
and the lines
Code: |
SPF/E VIEW MSTEST.SJ564D1N.SGG564P0.REPORT Columns
00001 00072
****** ***************************** Top of Data ****************************** |
are not a part of the file, its only a part of screen capture when you view a file.
Please correct me if i am wrong! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Oh, I see. I didn't realize those lines weren't part of the input (the poster could have said that). I wish people would explain what they want clearly to avoid confusion. |
|
Back to top |
|
|
|