View previous topic :: View next topic
|
Author |
Message |
sandeepsab1
New User
Joined: 07 Apr 2006 Posts: 6
|
|
|
|
Using JCL, Can we convert a file having alphanumeric 8 digit Account number
to a file having Numeric Account Number
|
|
Back to top |
|
 |
hariavinash
New User
Joined: 04 Jan 2006 Posts: 64
|
|
|
|
yes. you can use iceman/icetool. ifthen .. when clause to pad with zeroes.
cheers |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
/*
|
|
|
Back to top |
|
 |
sandeepsab1
New User
Joined: 07 Apr 2006 Posts: 6
|
|
|
|
Thanks for the reply.
But I think your solution will convert "1234 " to 12340000. Actually I am desiring to have it converted as 00001234.
Please correct me if I am wrong.
Please let me know if we can actually do this, using JCL
Thanks & regards
Sandeep |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
But I think your solution will convert "1234 " to 12340000. Actually I am desiring to have it converted as 00001234.
Please correct me if I am wrong. Please let me know if we can actually do this, using JCL
|
You're wrong. Why do you think that? This IS the way to actually do this using DFSORT.
The DFSORT job does exactly what you asked for - it converts "1234 " to 00001234.
DFSORT's UFF format extracts the digits 1234. Then M11,LENGTH=8 converts the extracted digits to the pattern TTTTTTTT giving the extracted digits padded on the left with zeros, resulting in 00001234.
I tested this before I posted it to make sure it worked correctly. Why didn't you just try it to see if it worked instead of assuming it didn't?
Here's the job I used to test this:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
"1234 "
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
/*
|
Here are some of the DFSORT messages I got when I ran this:
Code: |
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE000I 1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0 - ...
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED
ICE088I 0 SANDE1 .S1 . , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,4194304,4181086)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (4068974,4068974)
...
ICE090I 0 OUTPUT LRECL = 8, BLKSIZE = 80, TYPE = FB
ICE171I 0 SORTOUT LRECL OF 8 IS DIFFERENT FROM SORTIN(NN) LRECL OF 80 - RC=0
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 1, OUT: 1
ICE052I 0 END OF DFSORT
|
Here's the SORTOUT output:
|
|
Back to top |
|
 |
sandeepsab1
New User
Joined: 07 Apr 2006 Posts: 6
|
|
|
|
Hello
I tried the same code as given by you as follows
//STEP010 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
"1234 "
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
/*
******************
But, it is giving me an error U0016, & the error message in SYSOUT as follows
SYSIN :
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
*
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
******************
I tried with all possible options like replacing BUILD by FIELDS, ICEMAN by SORT, & not getting the reason behind it.
Could you please tell me why the same JCL is giving error to me & ran fine with you. |
|
Back to top |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
Hi,
The solution that was given by Frank will work for DFSORT ,but not for SYNCSORT it seems.
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER messages are result of SYNCSORT.Please search the forum for the differneces between SYNCSORT and DFSORT.
Thank you
Krishy |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Sandeep,
The job I gave you works fine with DFSORT. But the WER messages indicate you're using Syncsort, not DFSORT. DFSORT supports the UFF format. Syncsort does not support the UFF format. |
|
Back to top |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
FWIW, a SAS solution:
Code: |
//SASSTEP EXEC SAS
//SAS.SASLOG DD SYSOUT=*
//SAS.SYSDUMP DD SYSOUT=*
//SAS.SASLIST DD SYSOUT=*
//SYSUT1 DD *
1234
/*
//SYSUT2 DD SYSOUT=*
//SYSIN DD *
DATA _NULL_;
INFILE SYSUT1;
FILE SYSUT2;
INPUT @1 LINE1;
FORMAT LINE1 Z8.;
PUT @1 LINE1;
/*
|
|
|
Back to top |
|
 |
sandeepsab1
New User
Joined: 07 Apr 2006 Posts: 6
|
|
|
|
Thanks for the solution.
One more thing I would like to ask is:
If my input file is having data as this
1000(followed by 6 spaces) 30 don
20(followed by 8 spaces) 20 sam
23456(followed by 5 spaces) 10 tim
how can i take care for the data 30 don, 20 sam, 10 tim to go in output file.
That is output file will look as
000001000 30 don
000000020 20 sam
000023456 10 tim
Can we do this?
Please tell me. |
|
Back to top |
|
 |
chandu_605k
New User
.jpg)
Joined: 17 Apr 2006 Posts: 7 Location: Kansas City
|
|
|
|
Hi Sandeep,
Frank is correct. Whatever the code frank has given was correct. I don't know, why its giving error when you execute. I have executed the code given by you(and by Frank also). Its giving correct results. See, the following code is same like your code, which you have tried with.
//SORTTEST JOB ,'CSRTEST1',CLASS=D,MSGCLASS=Q,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//*
//*
//STEP010 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
"1234"
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
/*
//*
The above code is working with input "1234" or '1234'.
Dear Mr Superk,
You are trying with proc "SAS" . But where is that proc. See, given answer should be clear. We can do in somany ways. But atleast one of those methods should give clear picture to others. Sorry for saying like this SuperK.
Ok Sandeep, Please try with that again.
Best Wishes |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
CSRao said
Quote: |
Frank is correct. Whatever the code frank has given was correct. I don't know, why its giving error when you execute. |
As noted previously, the job works fine with DFSORT. It's giving an error when Sandeep runs it because he's using Syncsort, not DFSORT. DFSORT supports UFF. Syncsort doesn't. |
|
Back to top |
|
 |
sandeepsab1
New User
Joined: 07 Apr 2006 Posts: 6
|
|
|
|
If anyone can reply to my query I would be thankful to him
SAS solution is working. I also understand how it worked.
But If the field to be operated is at some middle position, how to
code SYSIN DD * for that.
Here is my query once again with little formatting.
Can anyone give me SYSIN DD * for this if I want to use SAS
If my input file is having data as this
NEWJERSY(4-Spaces)1000(followed by 6 spaces) 30 don
FLORIDA(5-Spaces)20(followed by 8 spaces) 20 sam
TEXAS(7 Spaces)23456(followed by 5 spaces) 10 tim
how can i take care for the data 30 don, 20 sam, 10 tim to go in output file.
That is output file will look as
NEWJERSY(4-Spaces)000001000 30 don
FLORIDA(5-Spaces)000000020 20 sam
TEXAS(7 Spaces)000023456 10 tim
Can we do this?
Please tell me. |
|
Back to top |
|
 |
sandeepsab1
New User
Joined: 07 Apr 2006 Posts: 6
|
|
|
|
Can anybody please answer my Question posted about SAS.
I am desperately needing it. |
|
Back to top |
|
 |
habibullah_j
New User
Joined: 16 Mar 2006 Posts: 3
|
|
|
|
You can use NUMVAL function to convert an Alphanumeric value to Numeric.
Compute WS-NUM-FLD1 = FUNCTION NUMVAL(WS-ALPHA-NUM-FLD2)
cheers,
habib |
|
Back to top |
|
 |
Hanfur
Active User

Joined: 21 Jun 2006 Posts: 104
|
|
|
|
Frank,
I tried with your card and it gave the correct result though we have SYNCSORT in our shop.
Sandeepsab1,
I feel you got that error cos of SYNTAX PROBLEMS.
Sort card I used:
Same as Frank gave.
Output in spool:00001234
SYSOUT listing:
-------------------
OPTION COPY
INREC BUILD=(1,8,UFF,M11,LENGTH=8)
WER276B SYSDIAG= 197822, 589946, 589946, 537164
WER164B 31,580K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 48K BYTES RESERVE REQUESTED, 2,133,960 BYTES USED
WER146B 24K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER257I INREC RECORD LENGTH = 8
WER110I SORTOUT : RECFM=FB ; LRECL= 8; BLKSIZE= 8
WER416B BSAM WAS USED FOR SORTIN
WER416B BSAM WAS USED FOR SORTOUT
WER054I RCD IN 1, OUT 1
WER169I RELEASE 1.2 BATCH 0454 TPF LEVEL 1.0
-Han. |
|
Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Hanfur,
I last posted on this back in April. It's now July and things may have changed. DFSORT has had the UFF function since Dec, 2004. It may be that a newer level of Syncsort now has that function a year and a half later. |
|
Back to top |
|
 |
Hanfur
Active User

Joined: 21 Jun 2006 Posts: 104
|
|
|
|
Frank,
Quite right..I haven't checked the dates..
-Han. |
|
Back to top |
|
 |
|