Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  sortby.free.cob

  Sprache: Cobol
 

http://www.cobug.com/cobug/forums/cobolLang/130.shtml
*I am tasked with sorting an input file via an account
* number. This account number is not numeric, it is
* alpha numeric. It contains numbers only but can also
* have letters (in most cases). When I sort by acct
* nbr, the sort is incorrect because acct nbrs that
are greater than others are not in the correct 
* places. Is there a way for me to sort correctly
by just the numbers in the account number while
* ignoring the letters?

* The acct nbr can show up like the following
* examples:

123456ABC
456789
123ABC
12345678ABC
1234

* Thanks


* Ru1

4/09/2008 08:46:43
* RE: COBOL sort by


*Message:
If the account number is an alpha field, you can
* check for numberics fir
            SD SortFile.
      01 Sort-record.
      05 sr-account-nbr-key pic 9(12).
      05 sr-account-nbr-x pic x(12).
      
      fd acct-file.
      01 acct-rec.
      05 in-acct pic x(12).
      05 in-acct-x redefines in-acct.
      10 in-acct-entry pic x(01occurs 12.
      
      working-storage.
      05 sub Pic 9(02).
      05 ws-account-nbr Pic x(12).
      05 ws-account-nbr-n redefines ws-account-nbr
      pic 9(12).
      
      05 ws-account-nbr-t redefines ws-account-nbr.
      03 ws-acct-entry pic x(01occurs 12.
      
      05 ws-ctr pic 9(01value zeros.
      
      Procedure Division.
      
      read record.
      move in-acct to ws-account-nbr.
      if in-account-nbr numeric
      move ws-account-nbr-n to sr-account-nbr-key
      else
      perform 0000-handle-alpha.
      
      0000-handle-alpha.
      move spaces to ws-account-nbr.
      perform 0000-build-sort-key
      varying sub from 1 by 1
      until sub > 12
      or in-acct-entry(sub) numeric.
      
      move ws-account-nbr-n to sr-account-nbr-key.
      
      0000-build-sort-key.
      move in-acct-entry(sub) to ws-acct-entry(sub). 

Messung V0.5 in Prozent
C=95 H=99 G=96

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-06-15) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik