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

Need help on a complex sort


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

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Mon Jan 24, 2011 5:08 pm
Reply with quote

Hi All,

Could anyone please help me in the below required sort:

I/P File : -
VB, Lrecl = 1000
Condition :

1) Need to pick the values from position 10, length = 10. This is the key field for each and every record present in the input file.
2) For a record, search for the character "$", if found then pick the next 6 characters from the record and write it in the o/p. One record can contain more than one "$" values.
Each output record should append with the key value and the corresponding $ values. for e.g :-

Key $val1 $val2 $val3 then the o/p ll be ,

Key $val1
Key $val2
Key $val3

3) If the $ value is not present in the record then skip the record.

The input file looks like below.

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
ASDHJHHHC1234567890ASSD20219B$958746ASD99052565$852741887599999999
ASFFASFES98765432107834678         9999990525650010130000199999999
999999999852741963009SD20213NHJSF$65478900000650010130000199999999
999999999159753852913SD20$851239DBA  ASND$95147801013000019$999999
999999999391478562018SD20219DFASDVAHVAVDHASCD650010130000199999999



And the output should look like below,

The format and LRECL of o/p file should be of input file.

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
1234567890 $958746                                                     
1234567890 $852741                                                     
8527419630 $654789                                                     
1597538529 $851239                                                     
1597538529 $951478                                                     
1597538529 $999999                                                     
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 Jan 25, 2011 2:01 am
Reply with quote

Quote:
One record can contain more than one "$" values.


What is the maximum number of "$" values one record can contain?
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Tue Jan 25, 2011 8:46 am
Reply with quote

Hi Frank,

Thanks for your reply.

In the above query , the maximum no of $ values on each record can be 99.
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 Jan 26, 2011 2:39 am
Reply with quote

You could use a DFSORT/ICETOOL job like the following to do what you want (although I'm not sure you'll want to):

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file (VB/1000)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD LRECL=1000,DSN=...  output file (VB/1000)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,VLTRIM=C' ',
   PARSE=(%01=(ABSPOS=24,STARTAT=C'$',FIXLEN=7),
          %02=(STARTAT=C'$',FIXLEN=7),
          ... fill in the rest
          %98=(STARTAT=C'$',FIXLEN=7),
          %99=(STARTAT=C'$',FIXLEN=7)),
   BUILD=(1,4,14,10,X,%01,/,
          1,4,14,10,X,%02,/,
          ... fill in the rest
          1,4,14,10,X,%98,/,
          1,4,14,10,X,%99)
/*
 //CTL2CNTL DD *
   OMIT COND=(1,2,BI,LT,16)
/*

Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Thu Jan 27, 2011 5:59 pm
Reply with quote

Hi Frank,

Thanks a lot for your help.

I made the change as per my requirement by keeping this as a base and it is working fine.
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 How to split large record length file... DFSORT/ICETOOL 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top