View previous topic :: View next topic
|
Author |
Message |
manojkumar.sesuraj
New User
Joined: 15 Apr 2009 Posts: 43 Location: Mumbai
|
|
|
|
Hi,
I have 500 or more number of records. The record layout is,
manoj
bcdefg
ddg
dfddddddf
yyyyyy
This field length is 10 bytes. I want to select this data and add 'NAME-' label infront and '-END' at the end. My report should be like,
NAME-manoj-END
NAME-bcdefg-END
NAME-ddg-END
NAME-dfddddddf-END
NAME-yyyyyy-END
Is there any special command to suppress the spaces in DFSORT? It is not only DFSORT, that is fine for REXX or SAS... |
|
Back to top |
|
|
manojkumar.sesuraj
New User
Joined: 15 Apr 2009 Posts: 43 Location: Mumbai
|
|
|
|
I forgot to change the subject, The actual subject is "How to suppress the SPACES?".
Title edited per request. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Assuming your input name field is 10 bytes long
Below sortcard will give you desired output.
Code: |
//SYSIN DD *
OPTION COPY
INREC FIELDS=(C'NAME-',1,10,C'-END')
OUTFIL BUILD=(1,19,SQZ=(SHIFT=LEFT))
/*
|
Or using ifthen
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
manoj
bcdefg
ddg
dfddddddf
yyyyyy
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(C'NAME-',1,10,C'-END')),
IFTHEN=(WHEN=NONE,BUILD=(1,19,SQZ=(SHIFT=LEFT)))
/*
|
|
|
Back to top |
|
|
manojkumar.sesuraj
New User
Joined: 15 Apr 2009 Posts: 43 Location: Mumbai
|
|
|
|
Thanks Sam... It is working fine...
But, It is suppressing all spaces. For example,
Input:
manoj
aaaaaaaa
bbb
ccccccc
Output:
Please consider the BOLD letters are constants. It won't get change. We are just passing the data from input file.
My name ('manoj') and dept ('11111')
My name ('aaaaaaa') and dept ('11111')
My name ('bbb') and dept ('11111')
My name ('ccccccc') and dept ('11111')
How can i get this format? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
But, It is suppressing all spaces. |
You got what You asked for, a solution for the example You posted
why complain ??
if You had posted a different example You would have received a different solution |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
You can use below for it..
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
manoj
bcdefg
ddg
dfddddddf
dfddddddff
yyyyyy
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(C'"My name (''"',1,10,
C'"'') and dept (''11111'')"')),
IFTHEN=(WHEN=INIT,BUILD=(1,46,SQZ=(SHIFT=LEFT,PAIR=QUOTE))),
IFTHEN=(WHEN=NONE,FINDREP=(IN=C'"',OUT=C''))
|
Output will be
Code: |
My name ('manoj') and dept ('11111')
My name ('bcdefg') and dept ('11111')
My name ('ddg') and dept ('11111')
My name ('dfddddddf') and dept ('11111')
My name ('dfddddddff') and dept ('11111')
My name ('yyyyyy') and dept ('11111')
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Manoj,
Here's an easier way to do what you want with DFSORT:
Code: |
OPTION COPY
INREC BUILD=(1,10,JFY=(SHIFT=LEFT,LENGTH=80,
LEAD=C'My name (''',
TRAIL=C''') and dept (''11111'')'))
|
|
|
Back to top |
|
|
manojkumar.sesuraj
New User
Joined: 15 Apr 2009 Posts: 43 Location: Mumbai
|
|
|
|
Thanks a lot Frank & Sam... |
|
Back to top |
|
|
|