MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Varying Count Masking

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Tue Jun 14, 2011 9:17 am    Post subject: Varying Count Masking Reply with quote

Hi,

I've an input file like this

Code:

JOB       TAG
====      ======
ACR0001   MF-JOB
ACR0002   MF-JOB

ACSA001   MF-JOB
ACSA002   MF-JOB

ACSB001   UX-JOB
ACSB002   UX-JOB

ACSC001   UX-JOB
ACSD002   MF-JOB



Code:


OUTPUT
                  CNT
                  ===
ACR       MF-JOB   2
ACSA      MF-JOB   2
ACSB      UX-JOB   2
ACSC001   UX-JOB   1
ACSD002   MF-JOB   1




I've to sort the input first by 3 characters of job & the tag and get the counts.
If I get only 1 record (ex: ACR JOBS above) --> write to output.
If I get > 1 record,now repeat the process with 4 characters of job name
repeat the process until job is 7 characters

Thanks,
Vijay[/list]
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Tue Jun 14, 2011 10:47 am    Post subject: Reply with quote

vijay,

Use the following DFSORT JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
ACR0001   MF-JOB                                           
ACR0002   MF-JOB                                           
ACSA001   MF-JOB                                           
ACSA002   MF-JOB                                           
ACSB001   UX-JOB                                           
ACSB002   UX-JOB                                           
ACSC001   UX-JOB                                           
ACSD002   MF-JOB                                           
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=(81,7,CH,A),EQUALS                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,7,3C'0',C'1')),   
  IFTHEN=(WHEN=(4,4,FS,EQ,NUM),OVERLAY=(84:4X)),           
  IFTHEN=(WHEN=(5,3,FS,EQ,NUM),OVERLAY=(85:3X)),           
  IFTHEN=(WHEN=(6,2,FS,EQ,NUM),OVERLAY=(86:2X)),           
  IFTHEN=(WHEN=(7,1,FS,EQ,NUM),OVERLAY=(87:X))             
  SUM FIELDS=(88,4,ZD)                                     
                                                           
  OUTREC IFOUTLEN=80,                                     
  IFTHEN=(WHEN=(88,4,ZD,GT,1),OVERLAY=(1:81,7,20:88,4)),   
  IFTHEN=(WHEN=(88,4,ZD,EQ,1),OVERLAY=(20:88,4))           
//*


The output is
Code:

ACR       MF-JOB   0002
ACSA      MF-JOB   0002
ACSB      UX-JOB   0002
ACSC001   UX-JOB   0001
ACSD002   MF-JOB   0001

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Tue Jun 14, 2011 10:57 am    Post subject: Reply with quote

Thanks a Lot Kolusu.Great help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group