View previous topic :: View next topic
|
Author |
Message |
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
HI all,
Can I write a sort card to make a sum for this recin format??
01 ENFP08S-REC.
05 ENFP08S-DETT OCCURS 100.
10 ENFP08S-SIGN PIC X(001) VALUE SPACE.
10 ENFP08S-IMPO PIC Z.ZZZ.ZZZ.ZZZ.ZZ9,99.
10 ENFP08S-PV-06 PIC X(001) VALUE SPACE.
Thanks a lot |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
miosne
Quote: |
Can I write a sort card to make a sum for this recin format??
|
You may, but which field you want to sum and based on which field you want to sum(KEY).
Provide the sample i/p and o/p records.
With i/p and o/p file LRECL and RECFM |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
I want only make a SUM FIELDS on the ENFP08S-IMPO. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
miosne
As i asked before
Quote: |
Provide the sample i/p and o/p records.
With i/p and o/p file LRECL and RECFM
|
|
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
sory, the key is ENFP08S-PV-06.
Thanks a lot |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
I'll try to put al the infromations needs.
The sort key is ENFP08S-CAGNZ.
The file lenght is 2500. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Quote: |
The sort key is ENFP08S-CAGNZ.
|
in the initial file layout, you havent shown this variable at all |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
no.
I've moved only a portion of the file.
:-(
Sorry |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Code: |
01 ENFP08S-REC.
05 ENFP08S-DETT OCCURS 100.
10 ENFP08S-SIGN PIC X(001) VALUE SPACE.
10 ENFP08S-IMPO PIC Z.ZZZ.ZZZ.ZZZ.ZZ9,99.
10 ENFP08S-PV-06 PIC X(001) VALUE SPACE. |
in this layout,
1. what is the SORT-KEY? and
2. Which field you want to SUM?
3. LRECL of the File?
4. REFCM of the file? |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
the sort key is enfp08s-pv-06
the field to sum is enfp08s-impo
the lrecl is 2500
the recfm is FB
thank you for your patience. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
If your SORT KEY falls with in OCCURS, you will have 100 SORT KEY's
Are you sure about the Layout.
OR
Do you want to SUM
ENFP08S-IMPO(1) + ENFP08S-IMPO(2) + ENFP08S-IMPO(3) + .... +ENFP08S-IMPO(100) for each record? |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
the both situations are my problem!!!! |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
To get useful answers there must be an agreement on terms
a file is composed of records,
for sorting purposes each record must have a key
( uniquely defined - with the key tokens in a fixed position )
What You call a key enfp08s-pv-06 looks like an index
and we are not even sure that all the entries will be filled,
so ( by sort terminology ) enfp08s-pv-06 does not qualify as a key
unless... You provided incomplete info..
naturally there is nothing wrong in asking on how to sum across columns,
but the terms must be clear |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Quote: |
the both situations are my problem!!!! |
Then do you want to sum ENFP08S-IMPO(1) + ENFP08S-IMPO(2) + ENFP08S-IMPO(3) + .... +ENFP08S-IMPO(100) for each record?
Example: IF i/p is
Code: |
AAAAA 12.34 34.45 62.43
BBBBB 32.43 54.23 34.54 |
Do you expect the o/p to be
Code: |
AAAAA 109.22
BBBBB 121.20 |
|
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
I want, if it's possible, to having this situation
occ-1 occ-2 occ-3 occ-100
AAAAA 12.34 34.45 62.43 .... 109.22
BBBBB 32.43 54.23 34.54 .... 121.20
.
.
.
total 44.77 88.68 96.97 |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
miosne
Since you havent given expected o/p and enough senarios, i have to ask some sample example and expected o/p
If the i/p has
Code: |
AAAAA 12.34 AAAB 34.45 AAAD62.43
BBBBB 32.43 AAAC 54.23 AAAD34.54
AAA1A 12.34 AAAB 34.45 AAAD62.43
BBBBB 32.43 AA1C 54.23 3AAD34.54 |
What is your expected o/p, where (AAAA,BBBB,AAAB,AAAC.....) are your SORT keys? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Krisprems,
If you revert back to Miosne's previous post and your previous post, notice that you created a horizontal sum - all of the values for the key.
What i believe is needed is a column (vertical) total for the fields.
If i've misunderstood, i'm sure i'll be informed |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Hi dick
Since the layout was an OCCURS of 100, i guessed the sum would be Horizontal. After Miosne's post, looks like its typical Vertical SUMMING.
But since the For each occurance there would be key, i wonder how would be the o/p is expected(as i have given my sample i/p in my previous post let me wait and watch for the expected o/p) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Krisprems,
Quote: |
let me wait and watch for the expected o/p |
Yes, that would be good.
My current/newest guess is that both line totals and column totals are needed.
We'll see later today |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
I need line and column total. |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
krisprems wrote: |
miosne
Since you havent given expected o/p and enough senarios, i have to ask some sample example and expected o/p
If the i/p has
Code: |
AAAAA 12.34 AAAB 34.45 AAAD62.43
BBBBB 32.43 AAAC 54.23 AAAD34.54
AAA1A 12.34 AAAB 34.45 AAAD62.43
BBBBB 32.43 AA1C 54.23 3AAD34.54 |
What is your expected o/p, where (AAAA,BBBB,AAAB,AAAC.....) are your SORT keys? |
this is my example that i've posted
occ 1 occ 2 occ 3 occ 100
AAAAA 12.34 34.45 62.43 .... 109.22
ABBBB 32.43 54.23 34.54 .... 121.20
.
.
.
total 44.77 88.68 96.97 230.42
My vertical key is the first byte of every record(enfp08s-cagnz in the copy)
for each line i need that the occurs from 1 until 99 was summed in the occurs 100.
I hope that I've not created more confusion |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
the murky point are the keys...
will they always be 1 to 99
will they always be ordered
with a one byte key You will have only 256 different records ( maybe duplicates )
Just curious but what is the business background in all this ???
I just looked at the data You provided,
and found something interesting
the key is two bytes and not one
since it is clearly an excel spreadsheet layout
case :
1) uploaded ... carry on the across computations in EXCEL
2) program generated ... have the program do the same
extreme solution
why not do everything in EXCEL ??? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
I do not really care for sort problems,
but I am very curious about the logic of asking and replying and providing
information about one' s problem.
and why still after 21 post the data layout is not clear
Not meant to offend, but You kept providing misleading information
Your data consistes clearly of comma/semi_colon separated values
ok for the plus sign, ok for the amount
but why in heaven You call enfp08s-pv-06 a key when
from the data You provided it is simply the separator of an EXCEL like layout
to conclude the across sum is a sum of "occurs clause" items with no key |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
Mi sembra che cosa vi sia dietro a questo lavoro non debba essere l'argomento del contendere.
Pensavo che, in questo luogo si potessero soddisfare curiosità ed affrontare problematiche che si possono risolvere in molti modi, a discrezione del singolo quale sia la migliore.
Mi chiedi come mai non si esegue in excel?
Se sono qui per porre domande a chi ne sa più di me, non dovresti chiederti come mai o perchè, ma aiutarmi nel risolvere, se possibile, un mio problema.
Saluti. |
|
Back to top |
|
|
miosne Warnings : 1 New User
Joined: 13 Mar 2006 Posts: 63 Location: italy
|
|
|
|
Il mio inglese non'è così evoluto da consentirmi di essere chiaro.
E soprattutto io cerco di porre un'esempio che sia sintetico, senza scendere nel particolare, perchè, vista la mia curiosità, vorrei evolvere un qualcosa mettendoci un po' del mio.
Senza rancore, Miosne. |
|
Back to top |
|
|
|