Deriving Row Count on Windows

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The DOS find command is used to find files within a tree - not characters within a file. Type in find /? in a CMD shell for more information. The DOS findstr command does not have a counting capability.

You ARE going to be up for processing the file. Fastest is probably a generic job that reads the row as a single VarChar; the Transformer outputs a single integer containing @INROWNUM and the Aggregator applies either Last or Max to yield the result you require. You could check in the Transformer that the last character of each line is Ctrl-C if you wish.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
adamski
Charter Member
Charter Member
Posts: 54
Joined: Thu Mar 20, 2003 5:02 pm

Post by adamski »

Thanks Ray

For FIND/? I get:

Code: Select all

Z:\DataStage\Projects\DEVELOPMENT1\Scripts>find/?
Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

  /V         Displays all lines NOT containing the specified string.
  /C         Displays only the count of lines containing the string.
  /N         Displays line numbers with the displayed lines.
  /I         Ignores the case of characters when searching for the string.
  /OFF[LINE] Do not skip files with offline attribute set.
  "string"   Specifies the text string to find.
  [drive:][path]filename
             Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
However your suggestion does work if I set the delimiter to ASCII(003), having two columns, one large generic varchar containing terminators, and the second a Char(1) being the last column without terminators.

Thanks

Adamski
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Curious.

Code: Select all

C:\Documents and Settings\Ray>help find
find -- find files within file tree
Usage:  find directory ... expression

Operators:
!                  not
-a                 and
-o                 or

Primaries:
-acl user-pattern[:[+-=]access-mask]
                   user-pattern appears in ACL with appropriate permissions
-atime #           accessed # days ago
-cpio cpio-file    write in cpio format
-ctime #           created # days ago
-depth             process directories after contents
-exec command ;    execute command; arg {} replaced by object name matched
-follow            follow symbolic links
-group name        group is name
-inum #            has inode number #
-level #           do not descend below # levels
-links #           has # links
-mtime #           modified in # days
-name pattern      name matching pattern
-ncpio cpio-file   write to cpio-file in cpio -c format
-newer file        modified more recently than file
-nogroup           not owned by any group
-none              do not invoke default -print option
-nouser            not owned by any user
-ok command ;      like -exec; but ask first
-perm  mask        permissions exact match
-perm -mask        permissions match with given mask
-perm onum         symbolic mode like in chmod
-print             print current
-prune             stop traversing lower into the tree at this point
-size #            has # blocks (512 byte blocks)
-type c            type of entry: "c" chosen from set [bcdfnp]
-user name         owned by name
-xdev              do not cross device boundaries from the root of tree

Each "#" represents a decimal integer: +# more than, -# less than, # exact.
I finally realised that I have MKS Toolkit installed! This is the UNIX find command! :oops:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply