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

Changing from the second record of the file


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

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Tue Oct 21, 2008 12:42 pm
Reply with quote

Hi,

I have a file with records that i have to sort. But I want to start sorting from the second record. What option should I use?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Oct 21, 2008 12:47 pm
Reply with quote

Hello Roshanii,

Is first record conatin any string like header or some string which differntiate it with other records. & Secondly on what key u want to sort the records key length & offset etc

Would you please provide sample i/p & out put for that?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Tue Oct 21, 2008 1:48 pm
Reply with quote

My input looks like this.

"0" header
1 roshni 100
1 sameer 200
1 pranati 300
1 keerthi 400
1 deepti 500

I have to sort from the second record and want the first record as it is in the output.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Oct 21, 2008 2:05 pm
Reply with quote

Hello Roshni i,


Would you provide the sample input as well ?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Tue Oct 21, 2008 2:28 pm
Reply with quote

My input looks like this
Code:


Header   record
sandrew bangalore  testing
akash              development
lisa    pune       testing
john               testing
        joan       harry
                   harry
bill



And My jcl goes like this


Code:


//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *

header record
sandrew bangalore  testing
akash              development
lisa    pune       testing
john               testing
        joan       harry
                   harry
bill

        frank      george
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:1,30)),
    IFTHEN=(WHEN=(41,7,CH,NE,C' '),
     OVERLAY=(1:C'"',41,7,C'",'),HIT=NEXT),
    IFTHEN=(WHEN=(41,7,CH,EQ,C' '),
     OVERLAY=(1:C',',9X),HIT=NEXT),
    IFTHEN=(WHEN=(49,10,CH,NE,C' '),
     OVERLAY=(11:C'"',49,10,C'",'),HIT=NEXT),
    IFTHEN=(WHEN=(49,10,CH,EQ,C' '),
     OVERLAY=(11:C',',12X),HIT=NEXT),
    IFTHEN=(WHEN=(60,11,CH,NE,C' '),
     OVERLAY=(24:C'"',60,11,C'",'),HIT=NEXT),
    IFTHEN=(WHEN=(60,11,CH,EQ,C' '),
     OVERLAY=(24:C',',13X))
  OUTREC BUILD=(1,37,SQZ=(SHIFT=LEFT))
/*




So my output looks like this

Code:


"header","record",
"sandrew","bangalore","testing",   
"akash",,"development",             
"lisa","pune","testing",           
"john",,"testing",                 
,"joan","harry",                   
,,"harry",                         
"bill",,,                           
,,,                                 
,"frank","george",




But I want the first record to be skipped and to appear in the output as it is. How do I skip the first record and apply the sort only from the second record?

So ideally my output should look like this


Code:


header record
"sandrew","bangalore","testing",   
"akash",,"development",             
"lisa","pune","testing",           
"john",,"testing",                 
,"joan","harry",                   
,,"harry",                         
"bill",,,                           
,,,                                 
,"frank","george",
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Oct 21, 2008 3:01 pm
Reply with quote

Google Smart DFSORT Tricks.

Garry.
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 Oct 21, 2008 9:00 pm
Reply with quote

Roshnii,

Your description of what you want to do is quite confusing. You say you want to sort starting with the second record, but you're using OPTION COPY so you're NOT sorting, you're copying. What you really want to do is avoid changing the first record.

You were asked if there's something in the header to identify it, but you never answered that question which is an important one. You show 'header' in the header record. Is that string really there? If not, show what the header record actually looks like and indicate if there's something in the header record to identify it, or if it can only be identified as the first record.

What is the RECFM and LRECL of your input file?

What do you want for the RECFM and LRECL of your output file?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Wed Oct 22, 2008 3:43 pm
Reply with quote

My header looks like this
Code:


"0","RECORD","STATION","LEVEL",



The "0" is always present in the header. Also it is always the first record of the file. My lrec is 558. And it will remain the same.

So my input file looks like this (before sort)

Code:


"0","RECORD","STATION","LEVEL",
1 REC001 10203040506 MEMBER     
1 REC002 10203040506 SUB HEADER



and after the sort my output should look like this

Code:

"0","RECORD","STATION","LEVEL",
"1","REC001","10203040506"," MEMBER",     
"1","REC002","10203040506","SUB HEADER",



and the header should appear as it is in the output.
But in my case the header is also getting sorted which I do not want.
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 Oct 22, 2008 8:53 pm
Reply with quote

Again, you're NOT sorting anything. You're copying!

All you have to do is use another IFTHEN clause to ensure that no changes are made to the record with "0". For example:

Code:

  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:1,30)),         
    IFTHEN=(WHEN=(1,3,CH,EQ,C'"0"'),OVERLAY=(1:1,1)),
    IFTHEN=(WHEN=(41,7,CH,NE,C' '),                   
     OVERLAY=(1:C'"',41,7,C'",'),HIT=NEXT),           
    ...


The second IFTHEN clause here identifies the "0" record and essentially does a NOP (overlays positions 1 with itself). Since we don't have HIT=NEXT for this clause, none of the other clauses will be executed for the "0" record.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top