The JOBOPTS= option of the GRDSVC_ENABLE function has a sub-option named JOBNAME that lets you set the jobnames of submitted jobs. You give it the name of a macro variable, and before you start a new session with SIGNON you set the value of the macro variable to the name you want to use. If you're submitting your job with the sasgsub command, you can specify the name using the -gridjobname option .
Like so many things in grid processing, how to do this in code is poorly or obscurely documented. I wonder if the designers were trying to increase the need for buying SAS consulting services, or if they simply realized that there was no need to bother with good documentation because SAS Viya would provide an alternative in many cases. SAS has dropped previously supported functionality in the High Performance procs and told us to license Viya instead, so I lean towards the "no need to bother because it's going away" hypothesis.
There's some documentation at
https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=gridref&docsetTarget=n051...
and
https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=gridref&docsetTarget=n1x4...
and
https://documentation.sas.com/api/docsets/gridref/9.4/content/gridref.pdf?locale=en
The SAS online training probably does a better job of explaining how to use functions and statements to control grid processing.
There's an example with working code at
https://technodocbox.com/Windows/70068813-Overview-of-the-sas-grid.html