sort sum fields


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sort sum fields
# 1  
Old 11-18-2003
Question sort sum fields

HI ALL,

i have a problem when i do a sort sum with many fields.
Is there a limit for fields?
Do you know a solution?

thanks in advance.



the shell is:

Code:
# SORT1
SORT1_rcode=777

if [ $GLB_code -eq 0 ]; then
   echo "USE $DARSEQ/OTPU.FTPEPREC RECORD F,1000 " > $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "GIVE $DARTMP/__TPO501$$ RECORD F,1000 " >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "SORT FIELDS=(1,5,A,52,4,A),FORMAT=BI" >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "SUM FIELDS=(306,8,PD,314,8,PD,322,8,PD,330,8,PD,338,8,PD,346,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "354,8,PD,362,8,PD,370,8,PD,378,8,PD,386,8,PD,394,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "402,8,PD,410,8,PD,418,8,PD,426,8,PD,434,8,PD,442,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "450,8,PD,458,8,PD,466,8,PD,474,8,PD,482,8,PD,490,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "498,8,PD,506,8,PD,514,8,PD,522,8,PD,530,8,PD,538,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "546,8,PD,554,8,PD,562,8,PD,570,8,PD,578,8,PD,586,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "594,8,PD,602,8,PD,610,8,PD,618,8,PD,626,8,PD,634,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "642,8,PD,650,8,PD,658,8,PD,666,8,PD,674,8,PD,682,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "690,8,PD,698,8,PD,706,8,PD,714,8,PD,722,8,PD,730,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "738,8,PD,746,8,PD,754,8,PD,762,8,PD,770,8,PD,778,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "786,8,PD,794,8,PD,802,8,PD,810,8,PD,818,8,PD,826,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "834,8,PD,842,8,PD,850,8,PD,858,8,PD,866,8,PD,874,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "882,8,PD,890,8,PD,898,8,PD,906,8,PD,914,8,PD,922,8,PD," >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   echo "930,8,PD,938,8,PD,946,8,PD,954,8,PD,962,8,PD,970,8,PD)" >> $DARPARSRT/TPEKL508.SORT1_$$.srt
   mfsort take $DARPARSRT/TPEKL508.SORT1_$$.srt
   SORT1_rcode=$?
   echo SORT1_rcode=$SORT1_rcode
   if [ $SORT1_rcode -gt $GLB_code ]; then
      GLB_code=$SORT1_rcode
   fi
   cat SYSOUT
   rm  $DARPARSRT/TPEKL508.SORT1_$$.srt
fi

the return code is:

Code:
SEQUDEL_rcode=0
SORT109E: Too many fields specified
SORT015U: Command statement error(s) detected
SORT1_rcode=16
          Micro Focus MFJSORT Utility 3.0.00

          take /workprod/darp/param/srt/TPEKL508.SORT1_35314.srt
          USE /workprod/darp/fileseq/OTPU.FTPEPREC RECORD F,1000
          GIVE /workprod/darp/tmp/__TPO50135314 RECORD F,1000
          SORT FIELDS=(1,5,A,52,4,A),FORMAT=BI
          SUM FIELDS=(306,8,PD,314,8,PD,322,8,PD,330,8,PD,338,8,PD,346,8,PD,
          354,8,PD,362,8,PD,370,8,PD,378,8,PD,386,8,PD,394,8,PD,
          402,8,PD,410,8,PD,418,8,PD,426,8,PD,434,8,PD,442,8,PD,
          450,8,PD,458,8,PD,466,8,PD,474,8,PD,482,8,PD,490,8,PD,
          498,8,PD,506,8,PD,514,8,PD,522,8,PD,530,8,PD,538,8,PD,
          546,8,PD,554,8,PD,562,8,PD,570,8,PD,578,8,PD,586,8,PD,
          594,8,PD,602,8,PD,610,8,PD,618,8,PD,626,8,PD,634,8,PD,
          642,8,PD,650,8,PD,658,8,PD,666,8,PD,674,8,PD,682,8,PD,
          690,8,PD,698,8,PD,706,8,PD,714,8,PD,722,8,PD,730,8,PD,
          738,8,PD,746,8,PD,754,8,PD,762,8,PD,770,8,PD,778,8,PD,
          786,8,PD,794,8,PD,802,8,PD,810,8,PD,818,8,PD,826,8,PD,
SORT109E: Too many fields specified
          834,8,PD,842,8,PD,850,8,PD,858,8,PD,866,8,PD,874,8,PD,
          882,8,PD,890,8,PD,898,8,PD,906,8,PD,914,8,PD,922,8,PD,
          930,8,PD,938,8,PD,946,8,PD,954,8,PD,962,8,PD,970,8,PD)
SORT015U: Command statement error(s) detected

# 2  
Old 11-18-2003
Data ?

i don't know the shells
anybody knows nothing?
# 3  
Old 11-18-2003
mfsort is not a standard unix command. Shell programs can't fix a problem with some package just becuase it's invoked from the shell. Maybe Micro Focus can help you.
# 4  
Old 11-20-2003
Not sure if this will be of much help since I've never used mfsort, but I was reading 404 Not Found .

You could use the following to show the length of each line in the input file:

Code:
awk '{print length}' <filename>

Is it possible that the input file has varying record legnths with some not meeting SORT FIELDS=(1,5,A,52,4,A) requirments? I'd test it, but don't have a copy of mfsort or the input file. Is mfsort a standalone binary or does it require libraries etc. that are part of a Microfocus Cobol suite?

Cheers,

Keith
# 5  
Old 11-21-2003
Data

hi,

no, the file is correct.

thank you
# 6  
Old 11-21-2003
Is mfsort a standalone binary or does it require libraries etc. that are part of a Microfocus Cobol suite? If it works as a standalone and isn't too large, could I get a copy so I can try to help a little more?

Cheers,

Keith
# 7  
Old 11-21-2003
hi,

Is a part of Microfocus Server Express suite and it requires a Licence to run.

thanks the same
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies

2. Shell Programming and Scripting

Sort on first fields only

Please advice in this. Input file 100,vvvt 201,unb 100,sos 301,abc 99,gang desired output 99,gang 100,vvvt 100,sos 201,unb 301,abc Means if first fields are same ( here 100) the do not sort. (4 Replies)
Discussion started by: theshashi
4 Replies

3. Shell Programming and Scripting

Sum fields of different files using awk

I'm trying to sum each field of the second column over many different files. For example: file1: file2: 1 5 1 5 2 6 2 4 3 5 3 3 To get: file3 1 10 2 10 3 8 I found answer when there are only 2 files as... (10 Replies)
Discussion started by: rogeriog.em
10 Replies

4. Shell Programming and Scripting

Need help in finding sum for values in 2 different fields

Hi there, I have 2 files in following format cat file_1 Storage Group Name: aaaa HBA UID SP Name SPPort ------- ------- ------ 0 21 Storage Group Name: bbbb HBA UID... (2 Replies)
Discussion started by: jpkumar10
2 Replies

5. Shell Programming and Scripting

To perform sum aggregation on numeric fields

Hi all, I have following scenario to perform sum aggregation on certain columns Node Allocated_Space Pool_Name CS_Group Utilized Space -------- ---------------- ---------- --------- -------------- bdw1a_lun01 300 bdw_p0 ... (2 Replies)
Discussion started by: ckwan
2 Replies

6. Shell Programming and Scripting

doing a sort on first two fields

hi, i'm having a file stg_ff.txt which contains 10 fields,which contains millions of records i need to cat the first 10 rows in the file after doing a sorting on the first two fields i n the file. can any body help me on this. regards Angel (4 Replies)
Discussion started by: angel12345
4 Replies

7. UNIX for Dummies Questions & Answers

Sort on first two fields -only-

Hey, I have a file i want to sort. It contains these kind of lines: FirstName LastName buyID buyType Eg: John Doe 22 Car Jane Simpson 4 Headset John Doe 11 Telephone Now if I use the sort command on it cat purchases.txt | sort -k1,1 -k2,2 it would also sort the third and 4th field:... (4 Replies)
Discussion started by: ce3c
4 Replies

8. UNIX for Dummies Questions & Answers

sort on three fields

Hi I would like to sort a csv file. It has 50 fields and approx 1400000 lines. I want to sort by three columns as follows. Say sort on coulmn 5, if entries are equal sort on column 3 if this is also equal sort on column 6. It seems that this is possible for 5 then 3 i.e. sort -t "," -k 5,5 -k... (1 Reply)
Discussion started by: turquoise_man
1 Replies

9. Shell Programming and Scripting

calculating sum of fields in a file

Hey, I have a file and it has only one field. I need to calculate the sum of each filed as total. For e.g my file is 1 2 3 4 5 I need to calculate the total sum as 15. Please let me know how i can do it? (4 Replies)
Discussion started by: dsravan
4 Replies

10. Shell Programming and Scripting

sort on fields

Hi I have following fixed width file and I have to sort on 2 fields ABC 111222333002555 77788 ABC 111222333004555 77788 ABC 111222333001555 77788 ABC 111222333003555 77788 ABC 111222333005555 77788 one is from field1 to field 3 "ABC" and another is on 14 to 16 "002" (based on first... (1 Reply)
Discussion started by: mgirinath
1 Replies
Login or Register to Ask a Question