Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need help on a complex sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Niki

Active User


Joined: 20 Sep 2008
Posts: 102
Location: Bangalore

PostPosted: Mon Jan 24, 2011 5:08 pm    Post subject: Need help on a complex sort
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 Moderator


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

PostPosted: Tue Jan 25, 2011 2:01 am    Post subject:
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: 102
Location: Bangalore

PostPosted: Tue Jan 25, 2011 8:46 am    Post subject: Reply to: Need help on a complex sort
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 Moderator


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

PostPosted: Wed Jan 26, 2011 2:39 am    Post subject:
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: 102
Location: Bangalore

PostPosted: Thu Jan 27, 2011 5:59 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us