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

Reformat the dataset


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

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Jul 09, 2007 8:05 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jul 09, 2007 8:12 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jul 09, 2007 8:16 pm
Reply with quote

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
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Jul 09, 2007 8:47 pm
Reply with quote

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
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Jul 09, 2007 8:48 pm
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jul 09, 2007 9:04 pm
Reply with quote

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
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Jul 09, 2007 9:55 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Mon Jul 09, 2007 10:12 pm
Reply with quote

KS wrote:
i got the following error :
SORT STATEMENT : SYNTAX ERROR
Please provide the full error output.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jul 09, 2007 10:22 pm
Reply with quote

KS
try this
Code:
//SYSIN  DD  *
        SORT FIELDS=COPY
        OUTFIL STARTREC=4
//
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Jul 09, 2007 10:29 pm
Reply with quote

thats all the error its throwing .
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Mon Jul 09, 2007 10:38 pm
Reply with quote

Its working fine..
Thank you so much.

Thanks to one and all who replied.

Regards,
KS
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 Jul 10, 2007 1:03 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jul 10, 2007 1:06 am
Reply with quote

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
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Jul 10, 2007 10:30 am
Reply with quote

Frank
Quote:
Please, please test your control statements before you post them

Sorry for this. As you said i confused with SKIPREC and STARTREC. icon_redface.gif

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jul 10, 2007 8:37 pm
Reply with quote

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
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 FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top