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 

How can we add the horizontal values depend on condition

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


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Jul 11, 2007 8:34 am    Post subject: How can we add the horizontal values depend on condition Reply with quote

Hi,
I am having a FB file with length of 100.The first 10 are fixed and then there is an array of values(5).I want to add those array values on the basis of FIRST 2 BYTES and put them as a single array.

My i/p file(sample) :
Code:

AAAAAAAAAAZZ123ZZ123ZZ123AB124
AAAAAAAAAAZZ125ZZ125AB124kk125

I want to generate the o/p file as
Code:

AAAAAAAAAAZZ369AB124
AAAAAAAAAAZZ250AB124KK125


Note : We are having SYNCSORT version SYNCSORT FOR Z/OS 1.2.2.3R

Thanks
Bprasanna
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: Wed Jul 11, 2007 8:48 am    Post subject: Reply with quote

bprasanna,

What is the Layout of the input/output file?

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


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Jul 11, 2007 8:55 am    Post subject: Reply with quote

Kolusu,
Thank you!Both are fixed block with 100 length.I gave a sample i/p and o/p here so that I can modify it as per my requirement.
Thank you
Bprasanna
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Wed Jul 11, 2007 9:25 am    Post subject: Reply with quote

1. What if the combination of the numeric portions of 2 or more items with the same key is greater than 999?

2. assuming the Input area Pos 36 to Pos 100 is spaces, are the positions of unused items in the OUTPUT also to be spaces?

considering the nonsensical nature of this request, suggest you modify your item size to 6 and allow for a 4 char num (e.g. kk0999) which will never contain a value greater than 999. 5 items at 999 with same key would be 4995 - a 6 char item size.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Wed Jul 11, 2007 9:32 am    Post subject: Reply with quote

Quote:
I am having a FB file with length of 100.The first 10 are fixed and then there is an array of values(5).I want to add those array values on the basis of FIRST 2 BYTES and put them as a single array.


saying 'put them as a single array' does not make sense.
do you mean:

consolidate the items within a record based on a key, the key being the first 2 char of each item.

also, will there always be 5 array items? If less, will the unused item areas always be spaces?

?

Just a question. Are you trying to avoid writing the table-logic in a program that is already updating something based on the first 10 char of each record?
_________________
Dick Brenholtz
American living in Varel, Germany


Last edited by dbzTHEdinosauer on Wed Jul 11, 2007 9:35 am; edited 1 time in total
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Jul 11, 2007 9:33 am    Post subject: Reply with quote

Hi,
here is reply.

1)What if the combination of the numeric portions of 2 or more items with the same key is greater than 999?

No chance,The max allowed field is of lengh 3 bytes only(999 max).

2)assuming the Input area Pos 36 to Pos 100 is spaces, are the positions of unused items in the OUTPUT also to be spaces?

Yes

Thank you
Bprasanna
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Wed Jul 11, 2007 9:38 am    Post subject: Reply with quote

bprasanna,

Quote:
No chance,The max allowed field is of lengh 3 bytes only(999 max).


so that means, truncate on the left. e.g. to items AA777 and AA666. output is AA443, truncating the 1 from the actual total 1443.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Jul 11, 2007 9:42 am    Post subject: Reply with quote

yes,you are correct Dick.
_________________
----------------
Thanks&Regards
Bprasanna
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: Wed Jul 11, 2007 10:00 am    Post subject: Reply with quote

bprasanna,

There is a specific reason as to why I asked for the file layout , so that you would have less time to recode it and it makes a hell lot of difference if we are using comp and comp-3 fields. However since you did not provide me with the layout I only worked with the same data you have given.

Try this job.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
AAAAAAAAAAZZ123ZZ123ZZ123AB124
AAAAAAAAAAZZ125ZZ125AB124KK125
AAAAAAAAAAZZ100AB101DC102EF103
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC IFTHEN=(WHEN=INIT,
       OVERLAY=(101:11,2,13,3,9C'0',X,
                116:16,2,18,3,9C'0',X,
                131:21,2,23,3,9C'0',X,
                146:26,2,28,3,9C'0')),

        IFTHEN=(WHEN=(11,2,CH,EQ,16,2,CH),
       OVERLAY=(106:18,3),HIT=NEXT),
        IFTHEN=(WHEN=(11,2,CH,EQ,21,2,CH),
       OVERLAY=(109:23,3),HIT=NEXT),
        IFTHEN=(WHEN=(11,2,CH,EQ,26,2,CH),
       OVERLAY=(112:28,3),HIT=NEXT),

        IFTHEN=(WHEN=(16,2,CH,EQ,11,2,CH),
       OVERLAY=(121:13,3),HIT=NEXT),
        IFTHEN=(WHEN=(16,2,CH,EQ,21,2,CH),
       OVERLAY=(124:23,3),HIT=NEXT),
        IFTHEN=(WHEN=(16,2,CH,EQ,26,2,CH),
       OVERLAY=(127:28,3),HIT=NEXT),

        IFTHEN=(WHEN=(21,2,CH,EQ,11,2,CH),
       OVERLAY=(136:13,3),HIT=NEXT),
        IFTHEN=(WHEN=(21,2,CH,EQ,16,2,CH),
       OVERLAY=(139:18,3),HIT=NEXT),
        IFTHEN=(WHEN=(21,2,CH,EQ,26,2,CH),
       OVERLAY=(142:28,3),HIT=NEXT),

        IFTHEN=(WHEN=(26,2,CH,EQ,11,2,CH),
       OVERLAY=(151:13,3),HIT=NEXT),
        IFTHEN=(WHEN=(26,2,CH,EQ,16,2,CH),
       OVERLAY=(154:18,3),HIT=NEXT),
        IFTHEN=(WHEN=(26,2,CH,EQ,21,2,CH),
       OVERLAY=(157:23,3),HIT=NEXT),

        IFTHEN=(WHEN=(101,2,CH,EQ,116,2,CH),
       OVERLAY=(116:2X,12C'0'),HIT=NEXT),
        IFTHEN=(WHEN=(101,2,CH,EQ,131,2,CH),
       OVERLAY=(131:2X,12C'0'),HIT=NEXT),
        IFTHEN=(WHEN=(101,2,CH,EQ,146,2,CH),
       OVERLAY=(146:2X,12C'0'))

  OUTREC IFTHEN=(WHEN=INIT,
        OVERLAY=(103:103,3,ZD,ADD,
                     106,3,ZD,ADD,
                     109,3,ZD,ADD,
                     112,3,ZD,M11,LENGTH=3,9C'0',
                 118:118,3,ZD,ADD,
                     121,3,ZD,ADD,
                     124,3,ZD,ADD,
                     127,3,ZD,M11,LENGTH=3,9C'0',
                 133:133,3,ZD,ADD,
                     136,3,ZD,ADD,
                     139,3,ZD,ADD,
                     142,3,ZD,M11,LENGTH=3,9C'0',
                 148:148,3,ZD,ADD,
                     151,3,ZD,ADD,
                     154,3,ZD,ADD,
                     157,3,ZD,M11,LENGTH=3)),

        IFTHEN=(WHEN=(116,2,CH,EQ,C' '),
       OVERLAY=(116:131,14,15X),HIT=NEXT),
        IFTHEN=(WHEN=(116,2,CH,EQ,C' '),
       OVERLAY=(116:146,14,30X),HIT=NEXT),

        IFTHEN=(WHEN=(131,2,CH,EQ,C' '),
       OVERLAY=(131:146,14,15X),HIT=NEXT),
        IFTHEN=(WHEN=(131,2,CH,EQ,C' '),
       OVERLAY=(131:15X))

  OUTFIL BUILD=(001,10,
                101,05,
                116,05,
                131,05,
                146,05)

/*


Hope this helps...

Cheers

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


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Thu Jul 12, 2007 1:37 am    Post subject: Reply with quote

Hi Kolusu,
Thank you!

Thanks
Bprasanna
_________________
----------------
Thanks&Regards
Bprasanna
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