IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How can I generate a serie of numbers automatically


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sat Jan 23, 2010 6:16 pm
Reply with quote

hello, experts,

I'm going to make a D/S which containing number from 93000A to 93999A. (1000 records in all)
That is, the result dataset should be like this:

Code:

93000A
93001A
93002A
93003A
...
93999A

In the above result, record is from 93000 to 93999 with increment 1 when a new record added.
Can you provide me a relatively simple way to realize this?

Thank you very much!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Jan 23, 2010 8:39 pm
Reply with quote

edit a member/ds with 80 columns.

command line:
x all
delete all x

add one line

line comand:
R999

command line:
num on
renum
num off
bnds 1 6
x all

line command
>2

command line:
bnds 1 80
chg all 1 2 p'==' '93'
chg all 6 6 p'=' 'A'
reset

save <numset>
edit your target ds.
command line
num off
copy <numset>
save

have a good weekend.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Sun Jan 24, 2010 1:26 am
Reply with quote

Below SORT step will give you desired output...
Code:

//STEP0010 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
DUMMY RECORD                                                   
//SORTOUT  DD DSN=your.output.dsn                                     
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  OUTFIL REPEAT=1000,BUILD=(C'93',SEQNUM,3,ZD,START=0,C'A')     
//*                                                             
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Sun Jan 24, 2010 2:13 am
Reply with quote

Quote:
command line:
x all
delete all x

add one line

line comand:
R999

command line:
num on
renum
num off
bnds 1 6
x all

line command
>2

command line:
bnds 1 80
chg all 1 2 p'==' '93'
chg all 6 6 p'=' 'A'
reset

save <numset>
edit your target ds.
command line
num off
copy <numset>


omg i not tried this, pls tel me that this is a joke icon_smile.gif and does'nt work
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jan 24, 2010 3:22 am
Reply with quote

Hello,

Quote:
i not tried this, pls tel me that this is a joke
Why not? Why might you believe this is a joke icon_confused.gif

Suggest you run this on your system and reply back here with the outcome. . .
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sun Jan 24, 2010 11:13 am
Reply with quote

dbzTHEdinosauer wrote:
edit a member/ds with 80 columns.

command line:
x all
delete all x

add one line

line comand:
R999

command line:
num on
renum
num off
bnds 1 6
x all

line command
>2

command line:
bnds 1 80
chg all 1 2 p'==' '93'
chg all 6 6 p'=' 'A'
reset

save <numset>
edit your target ds.
command line
num off
copy <numset>
save

have a good weekend.


hi, Thank you for your quick answer.
but when I tried with your command, I failed.
I found error when I issue the following two commands:
>2

save <numset>

Would you please tell me the usage of the above "save <numset>" command?

I referred the command reference, but there was no parameters following SAVE according the "SAVE" command grammar.

Appreciate it very much!
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sun Jan 24, 2010 11:14 am
Reply with quote

Sambhaji wrote:
Below SORT step will give you desired output...
Code:

//STEP0010 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
DUMMY RECORD                                                   
//SORTOUT  DD DSN=your.output.dsn                                     
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  OUTFIL REPEAT=1000,BUILD=(C'93',SEQNUM,3,ZD,START=0,C'A')     
//*                                                             


The step goes well, thank you very much!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Jan 24, 2010 2:06 pm
Reply with quote

dejunzhu,

you are correct,
the line command should have been >1 not >2

and the SAVE <numset> was incorrect

should have been SAVE
i apologize that the description was not clear.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sun Jan 24, 2010 2:30 pm
Reply with quote

dbzTHEdinosauer wrote:
dejunzhu,

you are correct,
the line command should have been >1 not >2

and the SAVE <numset> was incorrect

should have been SAVE
i apologize that the description was not clear.

Hello, Thank you for your reply!

But I still cannot get the desired result with your commands.

Can you please have a try?

I still got error when I issue the following command:

>1
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Jan 24, 2010 3:33 pm
Reply with quote

>1 is a line command.

I was only trying to make you aware of the 'power' of ISPF. When one's skill set includes the ISPF edit commands that are available and the rather rich set of string manipulation capabilities of REXX, one can accomplish a lot in foreground mode.

That can be important, if you wish to get things done now, when you are working on a small machine or one that has so many users (last place I worked at had 10,000 avg tso users per day, submitting jobs all day long.
A simple job - less than 20 sec wall clock - sometimes had to wait for several hours to run.

a sort job - which if not invoked via rexx in foreground mode, will involve a batch job - a job submitted that must wait for time to run.

I do apologize for wasting your time on something that you had to learn and could adapt for future tasks,
instead of something that just provided you with a solution to your current problem.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sun Jan 24, 2010 4:11 pm
Reply with quote

dbzTHEdinosauer wrote:
>1 is a line command.

I was only trying to make you aware of the 'power' of ISPF. When one's skill set includes the ISPF edit commands that are available and the rather rich set of string manipulation capabilities of REXX, one can accomplish a lot in foreground mode.

That can be important, if you wish to get things done now, when you are working on a small machine or one that has so many users (last place I worked at had 10,000 avg tso users per day, submitting jobs all day long.
A simple job - less than 20 sec wall clock - sometimes had to wait for several hours to run.

a sort job - which if not invoked via rexx in foreground mode, will involve a batch job - a job submitted that must wait for time to run.

I do apologize for wasting your time on something that you had to learn and could adapt for future tasks,
instead of something that just provided you with a solution to your current problem.

I got it. Indeed I issued >1 as a line command. But not only >1 command did not work, I found ">" command did not take effect until I issue ")" command first.

I do not quite understand why this phenomenon appears, even though I investigated them from ISPF EDIT Command reference.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Sun Jan 24, 2010 5:08 pm
Reply with quote

Finally, I have found the solution to it.
Please allow me to amend your command in the following section:

num on ==>num on std cobol


>1 ==>)1


after the above modification, the desired dataset can be generated.

Thank you ,dick!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Jan 24, 2010 5:39 pm
Reply with quote

djunzhu,

you never have to ask my permission to modify code.
your modifying shows that you are learning - my intent.

thx, a very successful Sunday for me.

ps: you may have to insure that 73 - 80 are blanks - and not populated with sequence numbers.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Jan 25, 2010 11:19 pm
Reply with quote

FWIW, here's another way to do it with DFSORT:

Code:

//S1 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
DUMMY RECORD                                               
//SORTOUT  DD DSN=...  output file                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  OUTFIL REPEAT=1000,BUILD=(SEQNUM,5,ZD,START=93000,C'A')   
//*                                                         
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Jan 26, 2010 9:42 am
Reply with quote

Thank you , frank. The code runs smoothly.
Every time I need help, you are always ready. Thank you sincerely.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
No new posts JSON Generate COBOL Programming 2
No new posts XML-GENERATE to render edited numeric COBOL Programming 0
Search our Forums:

Back to Top