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 

Replace and Count.

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


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jul 08, 2010 7:54 am    Post subject: Replace and Count. Reply with quote

Hi,

The input file (LRECL=25,RECFM=FB) is like this....

Code:

----+----1----+----2----+----3
REC01.....P.....S.....E
REC02.....P.....S.....E
REC39 ROSE MARY H.....S
REC44.....T.....L.....S


The "....." represent low values. I would like to replace all these low values with spaces and report those statistics (how many got replaced) in sysout.

Quote:

Field1 - 6th to 10th columns
Field2 - 12th to 16th columns
Field3 - 18th to 22nd columns


In above case, I should get the output like this..

Code:

No. of fileds with low-values for Field1 - 3
No. of fields replaced with spaces for Field1 - 3
***
No. of fileds with low-values for Field2 - 3
No. of fields replaced with spaces for Field2 - 3
***
No. of fileds with low-values for Field3 - 4
No. of fields replaced with spaces for Field3 - 4
***


Please help.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jul 08, 2010 10:40 am    Post subject: Reply with quote

mf_user,

If your intention is to create a report as you have shown why do you need to replace it spaces?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jul 08, 2010 11:30 am    Post subject: Reply with quote

mfu,

Your description is quite unclear.

Quote:
I would like to replace all these low values with spaces and report those statistics (how many got replaced) in sysout


Code:

No. of fileds with low-values for Field1 - 3
No. of fields replaced with spaces for Field1 - 3


I see 3 records with low values for Field1 in your example, not 3 fields (whatever that would mean).

You say "No. of fields", but it looks like you really want the "No. of records" ... right?

Does a field have either all low values or no low values? Or can it have mixed low values and non-low values? For example could field1 have something like:

ABC...
.A.B.C
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jul 08, 2010 10:17 pm    Post subject: Reply with quote

Hi,

Sorry for the typo......yes. it is records and not fields. It will always have low-values only. They appear continuous and not like .A.B.C.

Kolusu, this file goes as input to another job also. We do a check and report those wrong values back to customer but want to proceed with data processing.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jul 09, 2010 2:07 am    Post subject: Reply with quote

mf_user wrote:
We do a check and report those wrong values back to customer but want to proceed with data processing.

[PERSONAL OPINION ON]

unless you can charge the customer more, based on your error report,
or simply tell the customer you can not process his faulty input data
you are wasting your own resources keeping track of what is changed.

simply change the low-values to spaces prior to processing the file,
or modify the input portion of your process to accept low-values and change them at that point.

Unless you have the ability to apply consequences,
just modify the data,
and save your breath.

[PERSONAL OPINION OFF]
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jul 09, 2010 10:31 am    Post subject: Reply with quote

mf_user,

The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD DSN=Your input FB 25 byte file,DISP=SHR       
//SORTOUT  DD SYSOUT=*                 
//REPORT   DD SYSOUT=*                 
//SYSIN    DD *     
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=(6,5,CH,EQ,X'0000000000'),                     
  OVERLAY=(6:5X,26:C'1'),HIT=NEXT),                                 
  IFTHEN=(WHEN=(12,5,CH,EQ,X'0000000000'),                         
  OVERLAY=(12:5X,27:C'1'),HIT=NEXT),                               
  IFTHEN=(WHEN=(18,5,CH,EQ,X'0000000000'),                         
  OVERLAY=(18:5X,28:C'1'),HIT=NEXT)                                 
                                                                   
  OUTFIL BUILD=(1,25)                                               
  OUTFIL FNAMES=REPORT,REMOVECC,NODETAIL,BUILD=(80X),               
  TRAILER1=('NO. OF RECORDS WITH LOW-VALUES FOR FIELD1      : ',   
            TOT=(26,1,ZD,M10,LENGTH=8),/,                           
            'NO. OF RECORDS REPLACED WITH SPACES FOR FIELD1 : ',   
            TOT=(26,1,ZD,M10,LENGTH=8),/,                           
            '***',/,                                               
            'NO. OF RECORDS WITH LOW-VALUES FOR FIELD2      : ',   
            TOT=(27,1,ZD,M10,LENGTH=8),/,                           
            'NO. OF RECORDS REPLACED WITH SPACES FOR FIELD2 : ',   
            TOT=(27,1,ZD,M10,LENGTH=8),/,                           
            '***',/,                                               
            'NO. OF RECORDS WITH LOW-VALUES FOR FIELD3      : ',   
            TOT=(28,1,ZD,M10,LENGTH=8),/,                           
            'NO. OF RECORDS REPLACED WITH SPACES FOR FIELD3 : ',   
            TOT=(28,1,ZD,M10,LENGTH=8),/,                           
            '***',80:X)                                             
//*

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


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Fri Jul 09, 2010 9:40 pm    Post subject: Reply with quote

Hi,

Thanks a lot for your help Very Happy
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Mon Jul 12, 2010 5:10 am    Post subject: Reply with quote

Hi,

I get the results into SYSOUT but not the report because job abends with S0C7 !

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Jul 12, 2010 10:04 am    Post subject: Reply with quote

mf_user wrote:
Hi,

I get the results into SYSOUT but not the report because job abends with S0C7 !

Thanks.


and we are supposed to solve it without looking at the job sysout or dump or the control cards you used?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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